Jump to content

divide in exact ratio using vex


vineet

Recommended Posts

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
Link to comment
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

Link to comment
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

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...