NAME

trand - return a random integer within a specified range


SYNOPSIS

value = trand([minimum,] maximum)


DESCRIPTION

Call trand to get a random integer that falls within the range specified by the arguments.

It's a good idea to call srand once to seed the random number generator before using trand. Otherwise, a seed of 1 will be used.


ARGUMENTS

minimum[optional], maximum
These arguments define the range within which falls the random value returned by trand. If minimum is not present, trand will return an integer value between 0 and maximum.


RETURNS

A random integer between minimum (or 0) and maximum.


EXAMPLES

   srand(0)
   min = -30
   max = 10
   for (i = 0; i < 20; i = i + 1) {
      randval = trand(min, max)
      print(randval)
   }

prints 20 random integers having values between -30 and 10, inclusive.


SEE ALSO

irand,

srand, random, rand, pickrand, pickwrand, spray_init, get_spray, maketable("random")


AUTHOR

Douglas Scott <dscott at netscape net>