#N canvas 510 33 452 533 12;
#X text 216 487 updated for Pd version 0.35;
#X text 27 18 You can generate weighted random numbers from uniformly
distributed ones. If you just want two possible outcomes with a varying
probability for each one \, you can do as shown:;
#X obj 128 123 random 100;
#X floatatom 181 152 4 0 100 0 - - - 0;
#X obj 128 181 moses 80;
#X text 30 248 This outputs a number at left 80% of the time \, otherwise
at right \, unless you override the "80" using the number box. You
may extend this to more than two possible outcomes \, for instance
like this:, f 56;
#X obj 125 365 random 100;
#X obj 125 393 moses 10;
#X obj 215 393 moses 30;
#X text 120 442 10%;
#X text 210 442 20%;
#X text 266 442 70%;
#X obj 128 94 bng 17 250 50 0 empty empty empty 17 7 0 10 #dfdfdf #000000
#000000;
#X text 152 92 <-- click to test;
#X obj 128 209 bng 17 250 50 0 empty empty empty 17 7 0 10 #dfdfdf
#000000 #000000;
#X obj 181 209 bng 17 250 50 0 empty empty empty 17 7 0 10 #dfdfdf
#000000 #000000;
#X obj 125 422 bng 17 250 50 0 empty empty empty 17 7 0 10 #dfdfdf
#000000 #000000;
#X obj 215 422 bng 17 250 50 0 empty empty empty 17 7 0 10 #dfdfdf
#000000 #000000;
#X obj 268 422 bng 17 250 50 0 empty empty empty 17 7 0 10 #dfdfdf
#000000 #000000;
#X obj 125 339 bng 17 250 50 0 empty empty empty 17 7 0 10 #dfdfdf
#000000 #000000;
#X text 148 337 <-- click to test;
#X text 214 152 <-- change probability;
#X connect 2 0 4 0;
#X connect 3 0 4 1;
#X connect 4 0 14 0;
#X connect 4 1 15 0;
#X connect 6 0 7 0;
#X connect 7 0 16 0;
#X connect 7 1 8 0;
#X connect 8 0 17 0;
#X connect 8 1 18 0;
#X connect 12 0 2 0;
#X connect 19 0 6 0;
