Randomize Statement

Language Items List

Definition:

Initializes the random-number generator, which allows a new sequence of random numbers to be generated.

Syntax:

Randomize [number]


Syntax Description


number Any valid numeric expression

Description:

The argument number initializes the random number generator by supplying a new seed value. If you do not use the number argument, the seed value defaults to the value returned by the Timer function. By placing a Randomize statement with no argument at the beginning of the program, you can generate a different sequence of random numbers each time the program is run.

The Rnd function generates the same sequence of random numbers every time the program is run if Randomize is not executed before the Rnd function, or if Randomize is simply not used. Repeatable sets of random numbers such as these are often generated to run standardized tests, or to make a game play the same way multiple times.

See Also:

Rnd Function