Page 1 of 1

Random Number Limit?

Posted: Tue Sep 03, 2013 3:46 pm
by Dugg Funnie
hey everybody, first post! woohoo!

So, I'm working on a plug-in that will randomly load two effects and assigned parameters to an XY pad. Here's the issue I'm running into:

I have a Random prim that's time seeded and using an AfterLoad prim to trigger the generation (and thus the FX selection/assignment) when the plug-in is loaded. However, I'll only have a grand total of 12 effects to choose from, and given that the random prim generates 0-32767, a good percentage of the time it ends up just loading the last plug-in in the Selector's index. So, what can I do to limit the Random's range to something like 0-12 or anything like that?

Re: Random Number Limit?

Posted: Tue Sep 03, 2013 4:03 pm
by CoreStylerz
Try this.
But is an workaround. :lol:
Seed max to 12.fsm
(386 Bytes) Downloaded 930 times

Re: Random Number Limit?

Posted: Tue Sep 03, 2013 8:46 pm
by trogluddite
Much easier to use Ruby.
The randomness is automatically time/process seeded, and to get a random number 0-11 (assuming the FX are zero indexed), you need just one line...

Code: Select all

output rand(12)

Yup, that's it, just paste that into a Ruby box and change the input to a trigger and the output to an integer - done!

Re: Random Number Limit?

Posted: Tue Sep 03, 2013 9:21 pm
by MyCo
...

Re: Random Number Limit?

Posted: Fri Sep 06, 2013 6:24 pm
by Dugg Funnie
/\ Wow. That was simple! Thanks!