If you have a problem or need to report a bug please email : support@dsprobotics.com
There are 3 sections to this support area:
DOWNLOADS: access to product manuals, support files and drivers
HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects
USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here
NEW REGISTRATIONS - please contact us if you wish to register on the forum
Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright
Random Number Limit?
5 posts
• Page 1 of 1
Random Number Limit?
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?
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?
- Dugg Funnie
- Posts: 3
- Joined: Tue Sep 03, 2013 3:35 pm
Re: Random Number Limit?
Try this.
But is an workaround.
But is an workaround.
Need my support for app development, website or custom scripts?
PM me if you are interested.
Experienced Java, J2EE, PHP, Javascript, Angular, Cloud Solutions developer.
PM me if you are interested.
Experienced Java, J2EE, PHP, Javascript, Angular, Cloud Solutions developer.
-
CoreStylerz - Posts: 327
- Joined: Sun Jan 22, 2012 2:19 am
- Location: italy
Re: Random Number Limit?
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...
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!
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!
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
Don't stagnate, mutate to create!
-
trogluddite - Posts: 1730
- Joined: Fri Oct 22, 2010 12:46 am
- Location: Yorkshire, UK
-
MyCo - Posts: 718
- Joined: Tue Jul 13, 2010 12:33 pm
- Location: Germany
Re: Random Number Limit?
/\ Wow. That was simple! Thanks!
- Dugg Funnie
- Posts: 3
- Joined: Tue Sep 03, 2013 3:35 pm
5 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 58 guests