Welcome to od|forum

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.

vineet

divide in exact ratio using vex

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 by vineet

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

thank you konstantin for your reply..........i tried that method earlier but that doesn't give me the exact control for the ratio

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now