#N canvas 510 45 535 586 12;
#X floatatom 140 248 5 0 0 0 - - - 0;
#X obj 167 125 f;
#X obj 140 198 random 4;
#X obj 74 197 random 2;
#X floatatom 74 245 5 0 0 0 - - - 0;
#X obj 167 150 t b b f;
#X obj 195 351 +;
#X obj 167 99 metro 100;
#X obj 167 74 tgl 19 0 empty empty empty 0 -6 0 8 #dfdfdf #000000 #000000 0 1;
#X obj 140 276 + 1;
#X floatatom 384 200 5 0 0 0 - - - 0;
#X obj 122 332 *;
#X msg 64 305 -1;
#X obj 278 85 moses 0;
#X obj 324 115 moses 100;
#X obj 278 115 * -1;
#X obj 384 143 * -1;
#X obj 384 168 + 200;
#X msg 97 305 1;
#X text 58 28 Random walk generator;
#X text 191 73 on/off;
#X text 384 220 output;
#X text 80 223 sign;
#X text 145 221 magnitude;
#X text 228 340 add prev value;
#X text 227 355 to random increment;
#X text 282 28 coercion to range 0-100 \; if out of range \, reflect;
#X text 281 58 us back in.;
#X text 270 542 updated for Pd version 0.37-1;
#X obj 74 276 sel 0 1;
#X text 59 398 A random walk is a special case of a Markov chain \, in which the states are integers and the transitions add or subtract a small amount from the previous state to get a new one. Here the [f] holds the state. When it gets a bang \, the previous state is added to a random number (from 1 to 4) multiplied by a random sign (-1 or 1). The new value is then coerced into the range (from 0 to 100).;
#X connect 0 0 9 0;
#X connect 1 0 5 0;
#X connect 2 0 0 0;
#X connect 3 0 4 0;
#X connect 4 0 29 0;
#X connect 5 0 3 0;
#X connect 5 1 2 0;
#X connect 5 2 6 1;
#X connect 6 0 13 0;
#X connect 7 0 1 0;
#X connect 8 0 7 0;
#X connect 9 0 11 1;
#X connect 10 0 1 1;
#X connect 11 0 6 0;
#X connect 12 0 11 0;
#X connect 13 0 15 0;
#X connect 13 1 14 0;
#X connect 14 0 10 0;
#X connect 14 1 16 0;
#X connect 15 0 10 0;
#X connect 16 0 17 0;
#X connect 17 0 10 0;
#X connect 18 0 11 0;
#X connect 29 0 12 0;
#X connect 29 1 18 0;
