Randomize statement
Initializes a random number generator.
Randomize [number]
The number argument can be any valid numeric expression.
Description
Randomize Initializes the Rnd function by using the number parameter to assign a new seed value to the random numbers generator. If number is omitted, the value returned by the system timer is used as the new seed value.
If you do not use Randomize, the first call to the Rnd function (without parameters) will use the same number as the seed value, followed by the last generated number as the seed value.
note to repeat the sequence of random numbers, call Rndwith a negative argument immediately before you call Randomize with a numeric argument. Randomize that use the same number value cannot repeat the previous sequence of random numbers.
The following example illustrates how to use the Randomize statement:
Dim MyValue, ResponseRandomize '
Initializes a random number generator. Do Until Response = vbNo
The random number that is generated between. MsgBox MyValue
Response = MsgBox ("Roll again? ", vbYesNo)
Loop