#N canvas 0 31 682 622 10;
#X msg 167 312 bang;
#X floatatom 133 407 5 0 0 0 - - -;
#X obj 125 478 tabread \$0-rand;
#X obj 125 456 t a a;
#X obj 125 311 until;
#X obj 125 503 + 0.001;
#X obj 125 527 tabwrite \$0-rand;
#X msg 251 247 bang;
#X obj 251 273 list-random 10 10;
#X msg 125 285 1000;
#X msg 168 336 seed 12123;
#X floatatom 204 406 5 0 0 1 length - -;
#N canvas 0 0 450 300 (subpatch) 0;
#X array \$0-rand 10 float 0;
#X coords 0 1 9 0 200 140 1;
#X restore 310 409 graph;
#N canvas 0 0 450 300 (subpatch) 0;
#X array \$0-dist 10 float 0;
#X coords 0 1 9 0 200 140 1;
#X restore 310 409 graph;
#X obj 251 336 t a a;
#X msg 317 304 3 8 0 2 3 5 1 4 7 2;
#X msg 259 304 1 0 0 1;
#N canvas 0 0 450 300 write-to-tables 0;
#X obj 227 103 list-len;
#X obj 308 180 s \$0-rand;
#X obj 115 103 list prepend 0;
#X obj 115 128 s \$0-dist;
#X obj 93 256 s \$0-dist;
#X msg 308 158 resize \$1 \, const 0;
#X msg 93 155 normalize 1;
#X msg 227 159 resize \$1;
#X obj 93 55 t b a a;
#X obj 93 33 inlet;
#X connect 0 0 7 0;
#X connect 0 0 5 0;
#X connect 2 0 3 0;
#X connect 5 0 1 0;
#X connect 6 0 4 0;
#X connect 7 0 4 0;
#X connect 8 0 6 0;
#X connect 8 1 2 0;
#X connect 8 2 0 0;
#X connect 9 0 8 0;
#X restore 281 363 pd write-to-tables;
#X text 79 20 [list-wrandom];
#X msg 464 304 10 20 70;
#X msg 164 286 100;
#X text 113 44 Use a list as a probability table for weighted random
numbers.;
#X obj 125 379 list-wrandom;
#X text 112 87 Inlets;
#X text 132 142 1: list of random weights. The weigths are used as
probabilities for their positions (zero-based);
#X text 111 179 Outlets:;
#X text 127 199 0: random number;
#X text 127 214 1: size of probability table (for convenience);
#X text 131 109 0: connected to [random] internally. "bang" to make
random choice \, "seed X" to seed;
#N canvas 262 240 530 406 markov-example 0;
#X text 32 19 Simple markov chain;
#X obj 77 208 list-wrandom;
#X obj 170 208 list-wrandom;
#X obj 263 208 list-wrandom;
#X obj 77 172 select 0 1 2;
#X obj 77 150 f;
#X obj 93 127 r \$0-state;
#X obj 77 279 s \$0-state;
#X obj 170 279 s \$0-state;
#X obj 263 277 s \$0-state;
#X obj 163 328 hradio 32 1 0 3 empty \$0-state state 0 -8 1 10 -262144
-1 -1 0;
#X obj 239 98 loadbang;
#X obj 77 97 bng 24 250 50 0 empty empty empty 17 7 0 10 -262144 -1
-1;
#X floatatom 91 242 5 0 0 0 - - -;
#X obj 91 259 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
-1;
#X floatatom 185 240 5 0 0 0 - - -;
#X obj 185 257 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X floatatom 277 239 5 0 0 0 - - -;
#X obj 277 256 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X obj 37 74 metro 200;
#X obj 37 55 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 1
;
#X msg 239 125 s0 10 20 70 \, s1 80 10 10 \, s2 50 25 25;
#X obj 239 159 route s0 s1 s2;
#X connect 1 0 7 0;
#X connect 1 0 13 0;
#X connect 2 0 8 0;
#X connect 2 0 15 0;
#X connect 3 0 9 0;
#X connect 3 0 17 0;
#X connect 4 0 1 0;
#X connect 4 1 2 0;
#X connect 4 2 3 0;
#X connect 5 0 4 0;
#X connect 6 0 5 1;
#X connect 11 0 21 0;
#X connect 12 0 5 0;
#X connect 13 0 14 0;
#X connect 15 0 16 0;
#X connect 17 0 18 0;
#X connect 19 0 5 0;
#X connect 20 0 19 0;
#X connect 21 0 22 0;
#X connect 22 0 1 1;
#X connect 22 1 2 1;
#X connect 22 2 3 1;
#X restore 125 563 pd markov-example;
#N canvas 520 99 494 396 META 0;
#X text 12 5 KEYWORDS control list_op;
#X text 12 25 LICENSE SIBSD;
#X text 12 155 AUTHOR Frank Barknecht;
#X text 12 175 HELP_PATCH_AUTHORS Frank Barknecht. "pd meta" information
added by Jonathan Wilkes for Pd version 0.42.;
#X text 12 45 DESCRIPTION use a list as a probability table for weighted
random numbers;
#X text 12 75 INLET_0 bang seed;
#X text 12 95 INLET_1 list;
#X text 12 115 OUTLET_0 float;
#X text 12 135 OUTLET_1 float;
#X restore 622 568 pd META;
#X connect 0 0 22 0;
#X connect 2 0 5 0;
#X connect 3 0 2 0;
#X connect 3 1 6 1;
#X connect 4 0 22 0;
#X connect 5 0 6 0;
#X connect 7 0 8 0;
#X connect 8 0 14 0;
#X connect 9 0 4 0;
#X connect 10 0 22 0;
#X connect 14 0 22 1;
#X connect 14 1 17 0;
#X connect 15 0 14 0;
#X connect 16 0 14 0;
#X connect 19 0 14 0;
#X connect 20 0 4 0;
#X connect 22 0 1 0;
#X connect 22 0 3 0;
#X connect 22 1 11 0;
