Tidal's rand emits a continuous stream of random floats 0-1 and irand n emits random integers 0 to n-1, both deterministic in time
TidalCycles provides two random pattern generators. rand is a continuous oscillator emitting pseudo-random floating-point values between 0.0 and 1.0; irand n works identically but emits integers from 0 to n-1, suitable for indexing sample folders. Because they are continuous (infinitely detailed) rather than discrete, any structural event that samples them gets its own value — so they must be attached to a structure source (a sound pattern, segment, struct) rather than standing alone. Both are deterministic, stateless functions of time: the same logical cycle always yields the same value, so patterns reproduce across runs and resetCycles replays the same ‘random’ sequence. Using rand in two places therefore gives the same stream; to get independent streams, shift one (e.g. slow 0.3 rand). Both support range to rescale their output.
Examples
d1 $ sound "bd*8" # pan rand -- random stereo placement
d1 $ sound "amencutup*8" # n (irand 8) -- random sample 0-7
d1 $ sound "arpy*4" # pan (range 0.25 0.75 $ rand) -- bounded random pan
Assessment
Given # n (irand 8), state the range of integers emitted and explain why the pattern needs a separate structure source. Then write code for two independent random pan streams and explain why naive reuse of rand would not give two different streams.