[PD] weighted random integers with arbran ?

tim vets timvets at gmail.com
Wed Aug 23 15:40:30 CEST 2006


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20060823/9ebda778/attachment.htm>
-------------- next part --------------
#N canvas 37 64 739 404 10;
#X obj 220 17 table probability 12;
#X obj 433 251 tabwrite probability;
#X obj 548 200 counter 0 11;
#X obj 433 165 t f b;
#X obj 308 197 counter 0 11;
#X obj 223 165 t f b;
#X obj 223 249 tabwrite values;
#X obj 220 43 table values 12;
#X obj 28 18 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X obj 28 45 arbran values probability;
#X obj 28 98 int;
#X floatatom 28 120 5 0 0 0 - - -;
#X floatatom 308 221 5 0 0 0 - - -;
#X msg 223 102 0 1 2 3 4 5 6 7 8 9 10 11;
#X msg 308 174 clear;
#X msg 548 177 clear;
#X obj 223 123 t l b;
#X obj 433 123 t l b;
#X obj 223 142 drip 5;
#X obj 433 142 drip 5;
#X msg 364 17 \; probability const 0 \; values 0;
#X text 81 74 try to round;
#X obj 28 75 + 0.25;
#X floatatom 548 224 5 0 0 0 - - -;
#X msg 433 102 0 0 0 0 1 0 0 0 0 0 0 0;
#X connect 2 0 1 1;
#X connect 2 0 23 0;
#X connect 3 0 1 0;
#X connect 3 1 2 0;
#X connect 4 0 6 1;
#X connect 4 0 12 0;
#X connect 5 0 6 0;
#X connect 5 1 4 0;
#X connect 8 0 9 0;
#X connect 9 0 22 0;
#X connect 10 0 11 0;
#X connect 13 0 16 0;
#X connect 14 0 4 0;
#X connect 15 0 2 0;
#X connect 16 0 18 0;
#X connect 16 1 14 0;
#X connect 17 0 19 0;
#X connect 17 1 15 0;
#X connect 18 0 5 0;
#X connect 19 0 3 0;
#X connect 22 0 10 0;
#X connect 24 0 17 0;


More information about the Pd-list mailing list