#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 443 10%;
#X text 210 443 20%;
#X text 266 443 70%;
#X obj 128 94 bng 19 250 50 0 empty empty empty 17 7 0 10 #dfdfdf #000000 #000000;
#X text 152 92 <-- click to test;
#X text 148 337 <-- click to test;
#X text 214 152 <-- change probability;
#X obj 128 209 bng 19 250 50 0 empty empty empty 17 7 0 10 #dfdfdf #000000 #000000;
#X obj 181 209 bng 19 250 50 0 empty empty empty 17 7 0 10 #dfdfdf #000000 #000000;
#X obj 125 423 bng 19 250 50 0 empty empty empty 17 7 0 10 #dfdfdf #000000 #000000;
#X obj 215 423 bng 19 250 50 0 empty empty empty 17 7 0 10 #dfdfdf #000000 #000000;
#X obj 268 423 bng 19 250 50 0 empty empty empty 17 7 0 10 #dfdfdf #000000 #000000;
#X obj 125 339 bng 19 250 50 0 empty empty empty 17 7 0 10 #dfdfdf #000000 #000000;
#X connect 2 0 4 0;
#X connect 3 0 4 1;
#X connect 4 0 16 0;
#X connect 4 1 17 0;
#X connect 6 0 7 0;
#X connect 7 0 18 0;
#X connect 7 1 8 0;
#X connect 8 0 19 0;
#X connect 8 1 20 0;
#X connect 12 0 2 0;
#X connect 21 0 6 0;
