DIAdem Help

Method: Randomize for VBS

  • Updated2024-09-12
  • 1 minute(s) read

Method: Randomize for VBS

Restarts the random number generator.

Object.Randomize(number)
ObjectVBS
Object with this method. You do not need to specify this object.
numberVariant
Specifies any numeric expression. If you do not enter a value, the Randomize method uses the current time value.
If you do not call Randomize, the Rnd method always generates the same random number sequence when called.

The following example generates random numbers between 0 and 10:

Dim MyValue, MyResponse
Call Randomize   ' Initialize random-number generator.
Do Until MyResponse = vbNo
   MyValue = Int(11 * Rnd)   ' Generate random value between 0 and 10.
   Call MsgBox (MyValue)
   MyResponse = MsgBox ("Again? ", vbYesNo)
Loop

See Also

Objects Overview

Related Topics

Randomize | Rnd