sclang: ServerShmInterface - try to avoid multiple destructor calls
[supercollider.git] / HelpSource / Classes / Pshuf.schelp
blobc89456de8cb21d32c3a6533091c5cedb76902f35
1 class:: Pshuf
2 summary:: sequentially embed values in a list in constant, but random order
3 related:: Classes/Prand
4 categories:: Streams-Patterns-Events>Patterns>List
6 description::
8 Returns a shuffled version of the strong::list:: item by item, with n strong::repeats::.
10 Examples::
12 code::
14 var a, b;
15 a = Pshuf([1, 2, 3, 4, 5], 3);  // repeat 3 times
16 b = a.asStream;
17 16.do({ b.next.postln; });
20 //Pshuf used as a sequence of pitches:
23 SynthDef(\help_sinegrain,
24         { arg out=0, freq=440, sustain=0.05;
25                 var env;
26                 env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction:2);
27                 Out.ar(out, SinOsc.ar(freq, 0, env))
28         }).add;
32 a = Pn(Pshuf(#[60, 60, 60, 61, 63, 65, 72], 4), inf).asStream;
33 Routine({
34         loop({
35         Synth(\help_sinegrain, [\freq, a.next.midicps]);
36         0.15.wait;
37         })
38 }).play;