Update of /cvsroot/pure-data/abstractions/footils/list-abs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24463
Added Files: list-wrandom-help.pd list-wrandom.pd Log Message: weighted random added
--- NEW FILE: list-wrandom.pd --- #N canvas 317 73 656 550 10; #X obj 319 41 inlet; #X obj 102 44 inlet; #X obj 319 146 list-reduce; #X obj 405 146 +; #X msg 421 109 0; #X obj 472 418 table $0-weights; #X obj 202 229 s $0-weights; #X obj 319 70 t a b a; #X obj 505 105 list-len; #X obj 202 176 change -1; #X msg 202 201 resize $1; #X obj 427 196 f 0; #X obj 455 197 + 1; #X obj 405 170 t a b a; #X obj 427 221 pack 0 0; #X obj 319 259 s $0-weights; #X obj 319 173 b; #X msg 319 196 normalize 1; #X obj 124 226 f; #X obj 124 251 until; #X obj 102 373 f; #X obj 124 316 f 0; #X obj 150 316 + 1; #X obj 175 347 tabread $0-weights; #X msg 140 290 0; #X obj 102 166 t b b b a; #X obj 102 442 outlet; #X obj 172 201 + 1; #X obj 175 377 <=; #X obj 155 407 select 0; #X obj 319 111 list prepend 0; #X obj 514 131 s $0-len; #X obj 202 151 r $0-len; #X obj 102 112 random 10000; #X obj 102 136 * 1e-04; #X obj 505 158 outlet; #X connect 0 0 7 0; #X connect 1 0 33 0; #X connect 2 0 16 0; #X connect 2 1 3 0; #X connect 3 0 13 0; #X connect 4 0 3 1; #X connect 4 0 11 1; #X connect 7 0 30 0; #X connect 7 1 4 0; #X connect 7 2 8 0; #X connect 8 0 31 0; #X connect 8 0 35 0; #X connect 9 0 10 0; #X connect 9 0 27 0; #X connect 10 0 6 0; #X connect 11 0 12 0; #X connect 11 0 14 0; #X connect 12 0 11 1; #X connect 13 0 2 1; #X connect 13 1 11 0; #X connect 13 2 14 1; #X connect 14 0 15 0; #X connect 16 0 17 0; #X connect 17 0 15 0; #X connect 18 0 19 0; #X connect 19 0 21 0; #X connect 20 0 26 0; #X connect 21 0 23 0; #X connect 21 0 20 1; #X connect 21 0 22 0; #X connect 22 0 21 1; #X connect 23 0 28 0; #X connect 24 0 21 1; #X connect 25 0 20 0; #X connect 25 1 18 0; #X connect 25 2 24 0; #X connect 25 3 28 1; #X connect 27 0 18 1; #X connect 28 0 29 0; #X connect 29 0 19 1; #X connect 30 0 2 0; #X connect 32 0 9 0; #X connect 33 0 34 0; #X connect 34 0 25 0;
--- NEW FILE: list-wrandom-help.pd --- #N canvas 239 116 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 4 float 0; #X coords 0 1 3 0 200 140 1; #X restore 310 409 graph; #N canvas 0 0 450 300 (subpatch) 0; #X array $0-dist 4 float 0; #X coords 0 1 3 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; #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;