Hi Tim,
Maybe this is what you need ... you give it a set of probabilities as a list of floats - it will weight them for you, so you don't necessarily need to keep them between 0 and 1. Then bang and it will output a random choice based on the probability.
Send it a list [1 2 3 4 5( then [bang( ... your output will be between 0 to 4, with 0 least likely and 4 most likely. The output is meant to be used as the index for an array or list element. Note that it accepts lists of up to length 32.
Built using PD-extended, so it definitely requires Frank's list-abs ...
~David
On 8/23/06, tim vets timvets@gmail.com wrote:
I want to make a weighted random generator.
More or less the way 'probalizer' works, but since I'm on windows that is not an option... Arbran should do this, but I have a problem: In the table for the values I enter 0 1 2 3 4 5 6 7 8 9 10 11 the probability table has 0 0 0 0 1 0 0 0 0 0 0 0 in it the sizes and Y ranges are respectively 12 for both, 0 to 11 for the first table and 0 to 1 for the second. after the outlet of arbran I put an [int] object. now I expect to ALWAYS get the number 4, right? It doesn't, sometimes it's 3... what am I overlooking?
(also see attachment, but the table's properties aren't saved so you have to set them again, maybe a ('save properties' alongside the 'save contents' button would be handy?)...)
Thank you!
Tim
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list