Randomize statement
Initialize the random number generator.
Randomize [number]
numberThe parameter can be any valid numeric expression.
illustrate
RandomizeusenumberParameter initializationRndThe random number generator of the function, assigning it a new seed value. If omittednumber, then the value returned by the system timer is used as the new seed value.
If not usedRandomize, the first callRndWhen a function (no argument), it will use the same number as the seed value, and then use the last generated value as the seed value.
NoticeTo repeat a sequence of random numbers, call it using the numerical parametersRandomizeBefore, call it immediately with negative value parametersRnd. Use the samenumberValueRandomizeThe previous sequence of random numbers cannot be repeated.
The following example shows how to use itRandomizeStatement:
Dim MyValue, ResponseRandomize '
Initialize the random number generator。Do Until Response = vbNo
MyValue = Int((6 * Rnd) + 1)'
produce1
arrive6
Random number between。MsgBox MyValue
Response = MsgBox ("Roll again? ", vbYesNo)
Loop