Added help for Pen and updated some other docs
[supercollider.git] / HelpSource / Classes / Ppoisson.schelp
blob28d6c177f0d7bbee240401e572aff53e63a0120a
1 class:: Ppoisson
2 summary:: random values that follow a Poisson Distribution (positive integer values)
3 related:: Classes/Pgauss
4 categories:: Streams-Patterns-Events>Patterns>Random
6 ClassMethods::
8 method::new
10 argument::mean
11 The mean of the distribution.
13 argument::length
14 Number of values produced.
16 Examples::
18 code::
20 var a, c, w;
21 a = Ppoisson(1.0, inf);
22 c = a.asStream.nextN(500);
23 w = Window.new("Ppoisson", Rect(10, 10, 540, 800));
24 // plot the values
25 c.plot(bounds: Rect(10, 10, 520, 380), discrete: true, parent: w);
26 // a histogram of the values
27 c.histo(500).plot(bounds: Rect(10, 410, 520, 380), parent: w);
31 var a, c, w;
32 a = Ppoisson(10.0, inf);
33 c = a.asStream.nextN(500);
34 w = Window.new("Ppoisson", Rect(10, 10, 540, 800));
35 // plot the values
36 c.plot(bounds: Rect(10, 10, 520, 380), discrete: true, parent: w);
37 // a histogram of the values
38 c.histo(500).plot(bounds: Rect(10, 410, 520, 380), parent: w);
41 // sound example
43 SynthDef(\help_sinegrain,
44         { arg out=0, freq=440, sustain=0.05;
45                 var env;
46                 env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction:2);
47                 Out.ar(out, SinOsc.ar(freq, 0, env))
48         }).add;
52 var a;
53 a = Ppoisson(1.0,inf).asStream;
55         loop {
56                 Synth(\help_sinegrain, [\freq, (a.next + 72).midicps]);
57                 0.02.wait;
58         }
59 }.fork;
63 var a;
64 a = Ppoisson(7.0,inf).asStream;
66         loop {
67                 Synth(\help_sinegrain, [\freq, (a.next + 72).midicps]);
68                 0.02.wait;
69         }
70 }.fork;