aboutsummaryrefslogtreecommitdiff
path: root/pd/doc/2.control.examples/20.weighted-random.pd
diff options
context:
space:
mode:
authorGuenter Geiger <ggeiger@users.sourceforge.net>2002-07-29 17:06:19 +0000
committerGuenter Geiger <ggeiger@users.sourceforge.net>2002-07-29 17:06:19 +0000
commit57045df5fe3ec557e57dc7434ac1a07b5521bffc (patch)
tree7174058b41b73c808107c7090d9a4e93ee202341 /pd/doc/2.control.examples/20.weighted-random.pd
parentda38b3424229e59f956252c3d89895e43e84e278 (diff)
This commit was generated by cvs2svn to compensate for changes in r58,
which included commits to RCS files with non-trunk default branches. svn path=/trunk/; revision=59
Diffstat (limited to 'pd/doc/2.control.examples/20.weighted-random.pd')
-rw-r--r--pd/doc/2.control.examples/20.weighted-random.pd44
1 files changed, 44 insertions, 0 deletions
diff --git a/pd/doc/2.control.examples/20.weighted-random.pd b/pd/doc/2.control.examples/20.weighted-random.pd
new file mode 100644
index 00000000..ed964a06
--- /dev/null
+++ b/pd/doc/2.control.examples/20.weighted-random.pd
@@ -0,0 +1,44 @@
+#N canvas 161 46 660 441 12;
+#X msg 103 95 bang;
+#X text 389 414 updated for Pd version 0.35;
+#X text 44 19 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 103 121 random 100;
+#X obj 102 174 bng 20 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X obj 169 174 bng 20 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X floatatom 205 148 3 0 100;
+#X text 250 148 <-- change probablilty;
+#X obj 103 149 moses 80;
+#X text 152 93 <-- click to test;
+#X text 61 219 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:;
+#X msg 106 305 bang;
+#X obj 106 331 random 100;
+#X obj 105 384 bng 20 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X obj 195 387 bng 20 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X text 155 303 <-- click to test;
+#X obj 106 359 moses 10;
+#X obj 196 360 moses 30;
+#X obj 263 387 bng 20 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#X text 103 409 10%;
+#X text 193 410 20%;
+#X text 265 409 70%;
+#X connect 0 0 3 0;
+#X connect 3 0 8 0;
+#X connect 6 0 8 1;
+#X connect 8 0 4 0;
+#X connect 8 1 5 0;
+#X connect 11 0 12 0;
+#X connect 12 0 16 0;
+#X connect 16 0 13 0;
+#X connect 16 1 17 0;
+#X connect 17 0 14 0;
+#X connect 17 1 18 0;