Spyrogif Posted October 2, 2010 Share Posted October 2, 2010 hi every one, i've a question about the rand() expression fonction. I use it in a classic copy stamping context. my "template" is a simple grid and "my primitive to copy" input is plug to a switch node who have many differents input (here 12). the expressions i used to control switch stamping is : int(fit(rand($PT),0,1,0,12)) a 10*10 points grid gives me this. the result is pretty good to me. all the switch input are present. Every inputs haves between 6% and 12 % chance to be present. it's exactly what i need. now a 4*4 points grid gives me this. here come my problem. i'm agree with the fact that some input appears more than one time. But why some inputs are so present (here the a11 input). Here 6 input are not used and the a11 input made 31% of the all thing. Is there any math\expression genius who can help me to get a more "spread" result when my template have a low point count. thanks a lot for your help. Quote Link to comment Share on other sites More sharing options...
mightcouldb1 Posted October 2, 2010 Share Posted October 2, 2010 I think it would be the easiest to just change your seed value. rand($PT * 123) Then you can change the number around until you are happy. Hope that helps, Jason Quote Link to comment Share on other sites More sharing options...
Spyrogif Posted October 3, 2010 Author Share Posted October 3, 2010 I think it would be the easiest to just change your seed value. rand($PT * 123) Then you can change the number around until you are happy. Hope that helps, Jason you right, i try a lot of differents seed value and one give me the result i need. I was thinking to something more "cartesian" but i'm completly happy with this. thanks for tips and quick reply . Quote Link to comment Share on other sites More sharing options...
graham Posted October 3, 2010 Share Posted October 3, 2010 An alternative thing you could do, if you just want randomization and don't really care about it being a purely randomized distribution, is you can just use a Sort SOP to randomize the point order and then just stamp $PT % (number of choices). random_grid.hip Quote Link to comment Share on other sites More sharing options...
Spyrogif Posted October 3, 2010 Author Share Posted October 3, 2010 An alternative thing you could do, if you just want randomization and don't really care about it being a purely randomized distribution, is you can just use a Sort SOP to randomize the point order and then just stamp $PT % (number of choices). .thanks graham, your way is just perfect and more flexible for my asset. I think i will use $PT % a lot of time now. 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.