hello. i can't figure out how to get a random value between two numbers. in maya i just type rand(8,10).
how can i do that in houdini? i couldn't find anything helpful in the functions list.
randomize between two numbers
6937 7 4-
- mickhah
- Member
- 32 posts
- Joined: Nov. 2018
- Offline
-
- toadstorm
- Member
- 402 posts
- Joined: April 2017
- Offline
in VEX:
where seed is the random seed (often @ptnum in a point wrangle)
in hscript expressions:
assuming the point number is the random seed
float foo = fit01(rand(seed), 8, 10);
in hscript expressions:
fit01(rand(@ptnum), 8, 10)
MOPs (Motion Operators for Houdini): http://www.motionoperators.com [www.motionoperators.com]
-
- mickhah
- Member
- 32 posts
- Joined: Nov. 2018
- Offline
-
- toadstorm
- Member
- 402 posts
- Joined: April 2017
- Offline
Maybe you ought to mention what your objective is?
MOPs (Motion Operators for Houdini): http://www.motionoperators.com [www.motionoperators.com]
-
- mickhah
- Member
- 32 posts
- Joined: Nov. 2018
- Offline
i want to emit a ring of particles. so i created an emitting object, have keyed emission so it bursts for one frame only, and then set the velocity variance to x=10 and z=10. but so the particles are emitting not as a ring but as a circle. my thought was that the variance goes from 0 to 10, but when i have used your code nothing changed. they are still moving as a circle filling whole radius.
-
- anbt
- Member
- 81 posts
- Joined: Dec. 2020
- Offline
-
- krueger
- Member
- 192 posts
- Joined: Oct. 2018
- Offline
-
- anbt
- Member
- 81 posts
- Joined: Dec. 2020
- Offline
mkps
You could do like toadstorm said and use a point wrangle with a code like this:f@random = fit01( rand(@ptnum), 8, 10 );
Or use the attribute randomize sop set to Set Value and specify the min/max values. If you want a float value, change the Dimensions to 1.
Thanks mkps, someone on odforce told me about this new node (attribute adjust integer) that does just that!
https://forums.odforce.net/topic/48337-how-to-randomly-replicate-points-between-two-values/ [forums.odforce.net]
-
- Quick Links