CitectVBA Programming Reference > CitectVBA Function Reference > Miscellaneous Functions > Randomize

Randomize

The Randomize statement initialises the random number generator.

It has one optional parameter number. This parameter can be any valid number and is used to initialise the random number generator. If you omit the parameter then the value returned by the Timer event is used as the default parameter to seed the random number generator.

Syntax

Randomize[number]

Related Functions

Timer

Example

Dim MValue
' Initialise random-number generator
Randomize
MValue = Int((6 * Rnd) + 1)
Print MValue