supernova: fix boost.thread move semantics
[supercollider.git] / Help / UGens / Random / RandID.html
bloba3f14a9b7845d50607697669f4c3079dbaf17bde
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <meta http-equiv="Content-Style-Type" content="text/css">
6 <title></title>
7 <meta name="Generator" content="Cocoa HTML Writer">
8 <meta name="CocoaVersion" content="949.43">
9 <style type="text/css">
10 p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}
11 p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Helvetica; min-height: 22.0px}
12 p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}
13 p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #001bb9}
14 p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Monaco; min-height: 16.0px}
15 p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #ad140d}
16 p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco}
17 p.p8 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px}
18 p.p9 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #2c7014}
19 span.s1 {font: 18.0px Helvetica}
20 span.s2 {color: #000000}
21 span.s3 {text-decoration: underline ; color: #0021e7}
22 span.s4 {text-decoration: underline}
23 span.s5 {color: #001bb9}
24 span.s6 {color: #2c7014}
25 span.Apple-tab-span {white-space:pre}
26 </style>
27 </head>
28 <body>
29 <p class="p1"><span class="s1"><b>RandID<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b></span><b>set the synth's random generator id</b></p>
30 <p class="p2"><br></p>
31 <p class="p1"><b>RandID.kr(seed)</b></p>
32 <p class="p1"><b>RandID.ir(seed)</b></p>
33 <p class="p3"><br></p>
34 <p class="p1">Choose which random number generator to use for this synth. All synths that use the same generator reproduce the same sequence of numbers when the same seed is set again<span class="Apple-converted-space"> </span></p>
35 <p class="p3"><br></p>
36 <p class="p4"><span class="s2">See also: <a href="RandSeed.html"><span class="s3">RandSeed</span></a></span> <a href="../../Core/Kernel/randomSeed.html"><span class="s4">randomSeed</span></a></p>
37 <p class="p5"><br></p>
38 <p class="p5"><br></p>
39 <p class="p5"><br></p>
40 <p class="p6">// start a noise patch and set the id of the generator</p>
41 <p class="p7">(</p>
42 <p class="p7"><span class="s5">SynthDef</span>(<span class="s6">\help_RandID</span>, { <span class="s5">arg</span> out=0, id=1;</p>
43 <p class="p7"><span class="Apple-tab-span"> </span><span class="s5">RandID</span>.ir(id);</p>
44 <p class="p7"><span class="Apple-tab-span"> </span><span class="s5">Out</span>.ar(out,<span class="Apple-converted-space"> </span></p>
45 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s5">WhiteNoise</span>.ar(0.05) + <span class="s5">Dust2</span>.ar(70)<span class="Apple-converted-space"> </span></p>
46 <p class="p7"><span class="Apple-tab-span"> </span>)</p>
47 <p class="p7">}).send(s);</p>
48 <p class="p7">)</p>
49 <p class="p5"><br></p>
50 <p class="p6">// reset the seed of my rgen at a variable rate</p>
51 <p class="p7">(</p>
52 <p class="p7"><span class="s5">SynthDef</span>(<span class="s6">\help_RandSeed</span> , { <span class="s5">arg</span> seed=1910, id=1;</p>
53 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s5">RandID</span>.kr(id);</p>
54 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s5">RandSeed</span>.kr(<span class="s5">Impulse</span>.kr(<span class="s5">FSinOsc</span>.kr(0.2, 0, 10, 11)), seed);</p>
55 <p class="p7">}).send(s);</p>
56 <p class="p8"><span class="Apple-tab-span"> </span></p>
57 <p class="p7">)</p>
58 <p class="p8"><br></p>
59 <p class="p6">// start two noise synths on left and right channel with a different randgen id</p>
60 <p class="p7">a = <span class="s5">Synth</span>(<span class="s6">\help_RandID</span>, [<span class="s6">\out</span>, 0, <span class="s6">\id</span>, 1]);</p>
61 <p class="p7">b = <span class="s5">Synth</span>(<span class="s6">\help_RandID</span>, [<span class="s6">\out</span>, 1, <span class="s6">\id</span>, 2]);</p>
62 <p class="p8"><br></p>
63 <p class="p6">// reset the seed of randgen 1<span class="Apple-converted-space"> </span></p>
64 <p class="p9"><span class="s2">x = </span><span class="s5">Synth</span><span class="s2">(</span>\help_RandSeed<span class="s2"> , [</span>\id<span class="s2">, 1]);</span></p>
65 <p class="p8"><br></p>
66 <p class="p6">// change the target randgen to 2 (affects right channel)</p>
67 <p class="p7">x.set(<span class="s6">\id</span>, 2);</p>
68 <p class="p8"><br></p>
69 <p class="p8"><br></p>
70 <p class="p8"><br></p>
71 </body>
72 </html>