Fyre Posted April 22, 2016 Share Posted April 22, 2016 (edited) I'm trying to make a random switch inside a for each loop to assign one of four different noises to the primitive in the current loop. I cant access $PR from inside the for each loop as its just looking at one primitive at a time, how can I get each loop to choose a random node? If it helps the objects are in separate primitive groups before the for each loop. Cheers Edited April 22, 2016 by Fyre Quote Link to comment Share on other sites More sharing options...
Constantin Posted April 22, 2016 Share Posted April 22, 2016 Hi, you can use an iteration number. 2 Quote Link to comment Share on other sites More sharing options...
acey195 Posted April 22, 2016 Share Posted April 22, 2016 (edited) you can use the stamp() expression of this, for example: round(rand(stamp("../","FORIDXVALUE",0))*3) Edited May 3, 2016 by acey195 fixed typo 1 Quote Link to comment Share on other sites More sharing options...
duebergang Posted May 14, 2018 Share Posted May 14, 2018 stamp() should be avoided if possible, checkout this thread for for-each example: https://www.sidefx.com/forum/topic/51345/ Quote Link to comment Share on other sites More sharing options...
Atom Posted May 14, 2018 Share Posted May 14, 2018 Stamp really does not show a performance penalty until you are over a few thousand points. So it is still quite valid on lower point count geo. And even if you have a 60,000+ point object you can still leverage stamp() and just write out the result after the stamp operation. Place a FileCache node after your massive stamp operation to recover performance. Quote Link to comment Share on other sites More sharing options...
acey195 Posted May 14, 2018 Share Posted May 14, 2018 this was also a post of 2 years ago :P, a lot of us (including me) have already moved on to the new compilable-new-foreach-structure Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.