6.1.2.10.2.1 Randomize

Function Declaration

 Sub Randomize(Optional Number As Variant) 

Parameter

Description

Number

Empty or numeric seed value. If the argument is not Empty it MUST be Let-coercible to Double.

Read Only

 Runtime Semantics.

§ Initializes the random-number generator.

§ Randomize uses Number to initialize the Rnd function's random-number generator, giving it a new seed value. If the argument is missing or Empty, the value returned by the system timer is used as the new seed value.

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

§ An implementation is only required to repeat sequences of random numbers when Rnd is called with a negative argument before calling Randomize with a numeric argument. Using Randomize without calling Rnd in such a way yields implementation-defined results.