linux: shared memory interface - link with librt
[supercollider.git] / HelpSource / Classes / Pwhite.schelp
blobd0c4db1e57784af98b6a9d030235530e3b8d2f2c
1 class:: Pwhite
2 summary:: random values with uniform distribution
3 related:: Classes/Pgauss
4 categories:: Streams-Patterns-Events>Patterns>Random
6 ClassMethods::
8 method::new
10 argument::lo
11 lower boundary of values.
13 argument::hi
14 upper boundary of values.
16 argument::length
17 number of values produced.
19 Examples::
21 code::
23 var a;
24 a = Pwhite(0.0, 1.0, inf);
25 c = a.asStream.nextN(500);
26 w = Window.new("Pwhite", Rect(10, 10, 540, 800));
27 // plot the values
28 c.plot(bounds: Rect(10, 10, 520, 380), discrete: true, parent: w);
29 // a histogram of the values
30 c.histo(500).plot(bounds: Rect(10, 410, 520, 380), parent: w);
34 var a;
35 a = Pwhite(0.0, 1.0, inf);
36 a.asStream.nextN(1000).plot;
40 // sound example
42 SynthDef(\help_sinegrain,
43         { arg out=0, freq=440, sustain=0.05;
44                 var env;
45                 env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction:2);
46                 Out.ar(out, SinOsc.ar(freq, 0, env))
47         }).add;
52 var a;
53 a = Pwhite(0.0, 1.0, inf).asStream;
55         loop {
56                 Synth(\help_sinegrain, [\freq, a.next * 600 + 300]);
57                 0.02.wait;
58         }
59 }.fork;
62 // this is equivalent to:
65         loop {
66                 Synth(\help_sinegrain, [\freq, rrand(0.0, 1.0) * 600 + 300]);
67                 0.02.wait;
68         }
69 }.fork;