#N canvas 253 3 809 807 10;
#X obj 123 407 random 2;
#X obj 123 348 t b b f;
#X obj 123 463 sel 0 1;
#X obj 215 525 +;
#X obj 185 524 *;
#X text 39 9 Random walk generator;
#X text 132 445 sign;
#X text 205 382 magnitude;
#X text 281 554 add prev value;
#X text 278 571 to random increment;
#X text 475 481 us back in.;
#X text 446 741 updated for Pd version 0.37-1;
#N canvas 219 245 417 417 coerce 0;
#X obj 41 182 moses 0;
#X obj 41 206 * -1;
#X obj 206 185 * -1;
#X obj 236 162 * 2;
#X obj 115 182 moses 128;
#X obj 41 294 outlet;
#X obj 41 44 inlet;
#X obj 173 48 inlet;
#X obj 206 210 + 256;
#X obj 173 95 t a a;
#X text 234 76 us back in.;
#X text 235 46 coercion to range 0-128 \; if out of range \, reflect
;
#X connect 0 0 1 0;
#X connect 0 1 4 0;
#X connect 1 0 5 0;
#X connect 2 0 8 0;
#X connect 3 0 8 1;
#X connect 4 0 5 0;
#X connect 4 1 2 0;
#X connect 6 0 0 0;
#X connect 7 0 9 0;
#X connect 8 0 5 0;
#X connect 9 0 4 1;
#X connect 9 1 3 0;
#X restore 361 468 pd coerce;
#X obj 439 105 loadbang;
#X obj 419 134 f \$1;
#X text 385 18 upper bound: must be > 0;
#X text 476 451 coercion to range 0-128 \; if out of range \, reflect
;
#X obj 201 408 random \$2;
#X obj 123 40 inlet;
#X obj 587 42 inlet;
#X obj 419 35 inlet;
#X obj 150 491 1;
#X obj 123 491 -1;
#X text 592 19 stepsize;
#X obj 587 127 f \$2;
#X obj 587 151 select 0;
#X obj 587 173 2;
#X obj 596 103 loadbang;
#X obj 587 202 f;
#X obj 361 529 outlet;
#X obj 151 293 * 0.5;
#X msg 419 208 128;
#X obj 419 155 moses 0;
#X obj 463 177 select 0;
#X obj 419 234 f;
#X text 159 312 start at bound/2;
#N canvas 197 353 488 430 router 0;
#X obj 66 43 inlet;
#X obj 231 273 outlet;
#X obj 270 245 outlet;
#X obj 309 215 outlet;
#X obj 231 125 list split 1;
#X obj 270 146 list split 1;
#X obj 309 169 list split 1;
#X obj 66 354 outlet;
#X obj 66 332 b;
#X obj 151 299 outlet;
#X obj 108 326 s \$0-seed;
#X text 286 272 value;
#X text 326 248 bound;
#X text 363 216 stepsize;
#X text 118 356 bang;
#X text 203 298 set value without output.;
#X obj 66 92 route bang seed set seed;
#X obj 189 174 s \$0-seed;
#X connect 0 0 16 0;
#X connect 4 0 1 0;
#X connect 4 1 5 0;
#X connect 5 0 2 0;
#X connect 5 1 6 0;
#X connect 6 0 3 0;
#X connect 8 0 7 0;
#X connect 16 0 8 0;
#X connect 16 1 10 0;
#X connect 16 2 9 0;
#X connect 16 3 17 0;
#X connect 16 4 4 0;
#X restore 123 87 pd router;
#X obj 353 439 clip 0 128;
#X obj 418 418 t a a;
#X text 449 235 bound;
#X text 615 203 stepsize;
#X text 130 636 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 (or zero) 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 0 to $bound) multiplied by a random
sign (-1 or 1). The new value is then coerced into the range from 0
to $bound;
#X obj 123 323 int;
#X obj 123 63 list trim;
#X msg 41 368 seed \$1;
#X obj 41 338 r \$0-seed;
#N canvas 228 198 627 317 LICENSE-BSD 0;
#X text 121 56 This software is copyrighted by Miller Puckette \, Reality
Jockey Ltd. and others. The terms (the "Standard Improved BSD License")
apply to all files associated with the software unless explicitly disclaimed
in individual files.;
#X text 123 148 See the file LICENSE.txt for the full license text.
;
#X restore 683 80 pd LICENSE-BSD;
#X connect 0 0 2 0;
#X connect 1 0 0 0;
#X connect 1 1 17 0;
#X connect 1 2 3 1;
#X connect 2 0 22 0;
#X connect 2 1 21 0;
#X connect 3 0 12 0;
#X connect 4 0 3 0;
#X connect 12 0 29 0;
#X connect 12 0 42 1;
#X connect 13 0 14 0;
#X connect 14 0 32 0;
#X connect 17 0 4 1;
#X connect 18 0 43 0;
#X connect 19 0 24 0;
#X connect 20 0 14 0;
#X connect 21 0 4 0;
#X connect 22 0 4 0;
#X connect 24 0 25 0;
#X connect 25 0 26 0;
#X connect 25 1 28 0;
#X connect 26 0 28 0;
#X connect 27 0 24 0;
#X connect 28 0 17 1;
#X connect 30 0 42 1;
#X connect 31 0 34 0;
#X connect 32 0 31 0;
#X connect 32 1 33 0;
#X connect 33 0 31 0;
#X connect 33 1 34 0;
#X connect 34 0 30 0;
#X connect 34 0 38 0;
#X connect 36 0 42 0;
#X connect 36 1 42 1;
#X connect 36 2 37 0;
#X connect 36 3 34 0;
#X connect 36 4 28 0;
#X connect 37 0 12 0;
#X connect 38 0 37 2;
#X connect 38 1 12 1;
#X connect 42 0 1 0;
#X connect 43 0 36 0;
#X connect 44 0 0 0;
#X connect 44 0 17 0;
#X connect 45 0 44 0;
