Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - randomize() initialize random number generator http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 randomize()         Initialize random number generator
------------------------------------------------------------------------------
 Declaration
   math.hdr

 Syntax
   proc randomize extern

 Arguments
   None.

 Return
   None.

 Description
   The randomize() function initializes the Force random number generator
   with a seed number based on the current time. After a call to randomize() 
   the random() and randomnum() functions are guaranteed to produce a
   unique sequence of random numbers.

 Example
   #define EXAMPLE_MATH
   #include example.hdr

   proc Test_randomize
   vardef
      uint n
   enddef
   randomize()       // initialize random number generator
   for n := 1 to 10
      ? random( 0 )  // generate random numbers
   next
   endproc

   proc main
   Test_randomize()
   endproc

See Also: randomnum()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson