home/ atoms/ sc-prand-pattern

Prand picks a random item from a list on each event, constrained to list members

Prand([list], repeats) is the random-selection sibling of Pseq: it takes the same arguments (a list and a repeats count, or inf) but instead of walking the list in order it returns a randomly chosen item from the list on every call. Output is therefore constrained to the members of the list — a four-item list yields only those four values, never anything in between. This makes Prand the tool for shuffling among a fixed set of pitches, durations, or amplitudes. Swap a Pseq for a Prand in a working Pbind and the same value pool is reordered randomly rather than cycled. Use .trace.play to print each chosen value to the Post window while debugging.

Examples

Pbind(\degree, Prand([0, 2, 4, 7], inf), \dur, 0.15).play;
// same pitch pool as a Pseq, but order is random each event

Assessment

Predict the set of pitches Prand([0,2,4,7], inf) can produce. Replace it with Pseq([0,2,4,7], inf) and describe how the output changes. Verify with .trace.play.

“Prandpicksarandomitemfromthelisteverytime.”
corpus · a-gentle-introduction-to-supercollider-bruno-ruviaro · chunk 4