Randomize

This statement initializes the random-number generator.

Syntax

Randomize [number]

Parameters

number
Any valid numeric expression.

Remarks

Randomize uses number to initialize the random-number generator of the Rnd function, giving it a new seed value. If you omit number, Randomize uses the value returned by the system timer as the new seed value.

If Randomize is not used, the Rnd function, with no parameters, uses the same number as a seed the first time it is called, and thereafter uses the last generated number as a seed value.

To repeat sequences of random numbers, call Rnd with a negative parameter immediately before using Randomize with a numeric parameter. Using Randomize with the same value for number does not repeat the previous sequence.