Rand package:tidal-core

rand is an oscillator that generates a continuous pattern of (pseudo-)random numbers between 0 and 1. For example, to randomly pan around the stereo field:
d1 $ sound "bd*8" # pan rand
Or to enjoy a randomised speed from 0.5 to 1.5, add 0.5 to it:
d1 $ sound "arpy*4" # speed (rand + 0.5)
To make the snares randomly loud and quiet:
sound "sn sn ~ sn" # gain rand
Numbers coming from this pattern are 'seeded' by time. So if you reset time (using resetCycles, setCycle, or cps) the random pattern will emit the exact same _random_ numbers again. In cases where you need two different random patterns, you can shift one of them around to change the time from which the _random_ pattern is read, note the difference:
jux (# gain rand) $ sound "sn sn ~ sn" # gain rand
and with the juxed version shifted backwards for 1024 cycles:
jux (# ((1024 <~) $ gain rand)) $ sound "sn sn ~ sn" # gain rand
randslice chops the sample into the given number of pieces and then plays back a random one each cycle:
d1 $ randslice 32 $ sound "bev"
Use fast to get more than one per cycle:
d1 $ fast 4 $ randslice 32 $ sound "bev"
randcat ps: does a slowcat on the list of patterns ps but randomises the order in which they are played.
d1 $ sound (randcat ["bd*2 sn", "jvbass*3", "drum*2", "ht mt"])
randrun n generates a pattern of random integers less than n. The following plays random notes in an octave:
d1 $ s "superhammond!12" # n (fromIntegral $ randrun 13)
Boolean rand - a continuous stream of true/false values, with a 50/50 chance.
Boolean rand with probability as input, e.g. brandBy 0.25 produces trues 25% of the time.
Just like rand but for whole numbers, irand n generates a pattern of (pseudo-) random whole numbers between 0 to n-1 inclusive. Notably used to pick a random samples from a folder:
d1 $ segment 4 $ n (irand 5) # sound "drum"
As randcat, but allowing weighted choice. In the following, the first pattern is the most likely and will play about half the time, and the last pattern is the less likely, with only a 10% probability.
d1 $ sound
$ wrandcat
[ ("bd*2 sn", 5), ("jvbass*3", 2), ("drum*2", 2), ("ht mt", 1) ]