Return a random choice from a specified set of numbers.
value = pickrand(number1 [, number2, … numberN ])
Parameters inside the [brackets] are optional.
Call pickrand to choose randomly among several numbers that you specify as its arguments.
It’s a good idea to call srand once to seed the random number generator before using pickrand. Otherwise, a seed of 1 will be used.
number1, number2, … numberN
There can be any number of numerical arguments to pickrand, as long as there is at least one.
One of the arguments to pickrand, selected randomly.
srand(1)
for (i = 0; i < 10; i = i + 1) {
pitch = pickrand(8.00, 8.02, 8.04, 8.05, 8.07, 8.09, 8.11)
print(pitch)
}
prints 10 pitches from a C major scale, selected randomly. There’s no guarantee that this will print each of the arguments at least once. Use the spray mechanism for that (spray_init, get_spray).
irand, srand, trand, random, rand, pickwrand, spray_init, get_spray, maketable(“random”)