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


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