Jump to content
Sign in to follow this  
majinpu

**VEX NOOB** create random float values

Recommended Posts

Hi there !

I just started to do some little things in vex!

I can't understand  how to create a random integer attribute.

 

If i put down an attribute wrangle on some points and I type in:

 

f@number = rand(@numpt);

 

I can get some random float values.

 

But if i write in :

 

i@number = rand(@numpt);

 

I can just get 0 on all my points.

 

I think is very simple but I cannot sort it out! may be with a fit function?

 

thanks!

Share this post


Link to post
Share on other sites

By default rand function creates a random number between 0 and 1 from a seed.

Multiply this value

i@rand_num = int(rand(@ptnum)*10);

or use fit function

i@rand_num = int(fit(rand(@ptnum), 0, 1, 0, 10));

And also in your example you used a @numpt as seed (which is return total number of points). 

Hope it's help.

Edited by MagicRej
  • Like 1

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
Sign in to follow this  

×