irand

Return a random number within a specified range.


Synopsis

value = irand([minimum,] maximum)

Parameters inside the [brackets] are optional.


Description

Call irand to get a random floating-point number 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 irand. Otherwise, a seed of 1 will be used.


Arguments


Examples

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

See Also

srand, trand, random, rand, pickrand, pickwrand, spray_init, get_spray, maketable(“random”)