NAME

spray_init - initialize a random integer spray can


SYNOPSIS

spray_init(spray_table_number, spray_table_size, random_seed)


DESCRIPTION

Call spray_init from a script to set up a random integer spray can. The idea is that you create a table of integers and then use get_spray to retrieve them. The table contains integers from zero to one less than the table size. (Another way to look at it is that each element takes its index as its value.) Repeatedly calling get_spray reads the table randomly, but in such a way that no number appears twice before all the other numbers have appeared once.


ARGUMENTS
spray_table_number
The numeric ID for the spray table. You can have as many as 32 tables, numbered from 0 to 31. Note that these are separate entities from tables created using the maketable scorefile command.

spray_table_size
The table can have as many as 512 values.

random_seed
An integer to seed the random number generator. Note that this re-seeds the same random number generator used by rand, random, irand, etc.


EXAMPLES
   seed = 78
   spray_init(3, 7, seed) // initialize table 3 with 7 elements

   for (i = 0; i < 21; i = i+1) {
      val = get_spray(3)
      print(val)
   }


SEE ALSO

get_spray, irand, pickrand, pickwrand, rand, random, srand, irand