random number in a switch ?

   8661   4   0
User Avatar
Member
91 posts
Joined: Oct. 2015
Offline
random number in a switch

i would like pick a random number from 0 - 3 from a switch please see picture
Edited by gfxfx - June 25, 2017 14:36:26

Attachments:
dd.jpg (185.2 KB)

User Avatar
Member
419 posts
Joined: Feb. 2012
Offline
what are you trying to do ? copy different geo into points?
User Avatar
Member
91 posts
Joined: Oct. 2015
Offline
I select a random integer from 0 - 3 so switch picks 1 of 4 sphere or tube or torus or box
User Avatar
Member
8514 posts
Joined: July 2007
Online
random number based on what?
let's say for now that you want random number every frame
floor(rand($F)*opninputs("."))
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
1 posts
Joined: May 2017
Offline
I'm new to houdini and expressions in general, but found this formula to work for one of my switches…

round(rand($F* 0.1)*3)

… if you have more than 4 switch connection, say you have 15, then you could change the formula to this…

round(rand($F* 0.1)*14)

This expression allows for random whole numbers from 0 to 14. A total of 15.

Cheers?
  • Quick Links