kiryha Posted May 23, 2018 Share Posted May 23, 2018 I am using modulus to add each 10th point to a group: @group_targetPoints = 1; if (@ptnum%10){ i@group_targetPoints = 0; } So I get evenly distributed points: 0, 10, 20, 30, ... etc. I wish to add or subtract a small number from each point number (like int(rand(@ptnum)*3)) to randomize distribution a bit. Have no idea how to solve this in this case. Adding a small random number to a modulus argument ( 10+int(rand(@ptnum)*3) breaks even pattern dramatically. VEX_groupSelectRandomize_001.hipnc Quote Link to comment Share on other sites More sharing options...
fsimerey Posted May 23, 2018 Share Posted May 23, 2018 (edited) @group_targetPoints = 1; int delta = 2; i@modulo = 10 + int(ceil(delta * fit01(rand(@ptnum + 354656), -1, 1))); if(@ptnum%@modulo) { i@group_targetPoints = 0; } I use delta to add or subtract the module 10. Here 10 +- a random between -2 to +2. I think it's not the good way. This approach seems better: @group_targetPoints = 0; int delta = chi("delta"); i@modulo = int(ceil(delta * fit01(rand(@ptnum + 356156), -1, 1))); if(@ptnum%30 == 0) { setpointgroup(0,"targetPoints", @ptnum + @modulo, 1); } Here for each modulo of 30, i setup in group another point near the point number. Edited May 23, 2018 by fsimerey 1 Quote Link to comment Share on other sites More sharing options...
Noobini Posted May 24, 2018 Share Posted May 24, 2018 (edited) here's mine. var means -/+ var to your given number. (ideally there should be a check to ensure the var doesn't exceed mod/2...otherwise, neighbours could encroach each other...but you might not care about this...) int pts[] = primpoints(0,0); foreach(int i; pts) { if(i%chi("mod")==0) // even distribution { // now add a little offset int range = chi("var")+1; int vari = fit01(rand(i+ch("seed")),-range,range); setpointgroup(0,"sel",i+vari,1); } } vu_ModSel.hipnc Edited May 24, 2018 by Noobini 1 Quote Link to comment Share on other sites More sharing options...
Noobini Posted May 24, 2018 Share Posted May 24, 2018 you can add a 'shift' if you like foreach(int i; pts) { if((i+chi("shift"))%chi("mod")==0) // even distribution { // now add a little offset int range = chi("var")+1; int vari = fit01(rand(i+ch("seed")),-range,range); setpointgroup(0,"sel",i+vari,1); } } 1 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.