NAME

pickrand - return a random choice from a specified set of numbers


SYNOPSIS

value = pickrand(number1 [, number2, ... numberN ])


DESCRIPTION

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.


ARGUMENTS

number
There can be any number of numerical arguments to pickrand, as long as there is at least one.


RETURNS

One of the arguments to pickrand, selected randomly.


EXAMPLES

   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).


AUTHOR

Douglas Scott


SEE ALSO

srand, random, rand, irand, pickwrand, spray_init, get_spray, gen20