ordiza
Aug. 18, 2010 23:36:58
random(a) is 0~1
but i want random numbers from input list.
for example
(0 1 2 3)->random->3
brianBurke
Aug. 19, 2010 00:49:33
This is easy in vops. You can create a switch vop and plug your list of inputs (constants) into the switcher inputs. Then you can fit a normal random number to the number of inputs with the fit range vop. Then plug the result of the fit into your switcher.
Good luck dude!
ordiza
Aug. 19, 2010 02:01:56
brianBurke
This is easy in vops. You can create a switch vop and plug your list of inputs (constants) into the switcher inputs. Then you can fit a normal random number to the number of inputs with the fit range vop. Then plug the result of the fit into your switcher.
Good luck dude!
thanks. but if i use fit node or expression in vopsop, it is make a float number.
i want integer random number within input integer number list.
if i use round(fit(random())), those are very same result.(like a 2,2,2,1,2…) that is not i want.
—-
input 0,1,2,3->random->0 or 1 or 2 or 3.
this is what i want.
Soothsayer
Aug. 19, 2010 04:43:32
Try python.
import random
r = random.sample(,1)
return r
mawi
Aug. 19, 2010 07:17:38
ordiza
brianBurke
This is easy in vops. You can create a switch vop and plug your list of inputs (constants) into the switcher inputs. Then you can fit a normal random number to the number of inputs with the fit range vop. Then plug the result of the fit into your switcher.
Good luck dude!
thanks. but if i use fit node or expression in vopsop, it is make a float number.
i want integer random number within input integer number list.
if i use round(fit(random())), those are very same result.(like a 2,2,2,1,2…) that is not i want.
—-
input 0,1,2,3->random->0 or 1 or 2 or 3.
this is what i want.
You are using the fit VOP to set number of samples.
Or use python…
ordiza
Aug. 19, 2010 07:42:42
mawi
ordiza
brianBurke
This is easy in vops. You can create a switch vop and plug your list of inputs (constants) into the switcher inputs. Then you can fit a normal random number to the number of inputs with the fit range vop. Then plug the result of the fit into your switcher.
Good luck dude!
thanks. but if i use fit node or expression in vopsop, it is make a float number.
i want integer random number within input integer number list.
if i use round(fit(random())), those are very same result.(like a 2,2,2,1,2…) that is not i want.
—-
input 0,1,2,3->random->0 or 1 or 2 or 3.
this is what i want.
You are using the fit VOP to set number of samples.
Or use python…
Thank you for you guys help!
Soothsayer
Aug. 19, 2010 19:37:26
Here is another technique only involving sops and expressions. Each frame it will randomly display a number out of a specified list. In this case the list is 0 12 5 6
Soothsayer
Aug. 20, 2010 01:05:41
Here is another one with just 2 nodes. It takes a comma separated list and spits out a random item from it, changing every frame.
It includes one of the longest single expressions I have probably ever written.
`(substr(details(opinputpath(“.”,0),“s”),(ceil((fit01(rand($F),0,(strlen(details(opinputpath(“.”,0),“s”))))+1)/3)*3)-3,2)) :shock:
Edit: There is a little mistake. It returns a string wheras that should (probably) be a float, so here is the modified expression:
`atof((substr(details(opinputpath(“.”,0),“s”),(ceil((fit01(rand($F),0,(strlen(details(opinputpath(“.”,0),“s”))))+1)/3)*3)-3,2)))