vineet Posted July 16, 2017 Share Posted July 16, 2017 (edited) hi... i want random value between 0 -3 in the ratio of 2:2:6... i used "fit(rand(@ptnum),0,1,0,3)" and it gives me random no. between 0 to 3 but i also want to get them in exact ratio in a procedural way thanks in advance Edited July 16, 2017 by vineet Quote Link to comment Share on other sites More sharing options...
ikoon Posted July 17, 2017 Share Posted July 17, 2017 Do you need float values? Values 0-2 on 40% of points and 2-3 on 60% of points? I would use this, attached is the test file: float myrandom; myrandom = rand(@ptnum)*10; // float values 0-10 if (myrandom < 4){ myrandom = fit(myrandom,0,4,0,2); } else { myrandom = fit(myrandom,4,10,2,3); } 10.hiplc Quote Link to comment Share on other sites More sharing options...
vineet Posted July 18, 2017 Author Share Posted July 18, 2017 thanks for the reply ikoon your expression is cool i also used same kind of logic for my work but now i want to make it more procedural so that we can change the no. of objects as well as the ratio at any point of time i will share with you when i will be done with this thanks Quote Link to comment Share on other sites More sharing options...
konstantin magnus Posted July 18, 2017 Share Posted July 18, 2017 You can also append a ramp after a random VOP to control the ratio. random_ramp_vop.hipnc 2 Quote Link to comment Share on other sites More sharing options...
vineet Posted July 20, 2017 Author Share Posted July 20, 2017 thank you konstantin for your reply..........i tried that method earlier but that doesn't give me the exact control for the ratio 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.