ID : 292
Randomize
Function
To initialize the random generator (reset the random number sequence).
Syntax
Randomize[(formula)]
Guaranteed entry
- Formula
- Set a new seed value based on the specified value. If it is omitted, return value of Timer becomes the argument.
Description
For argument formula, specify a new seed value given to the random number generator of Rnd function. If the argument formula is omitted, a value acquired from the system timer is used as a new seed value.
Related Terms
Attention
-
Example
'!TITLE "Initialization of Random Number Seed of Random Number Generation Command Rnd"
' Create and display a random number over 0 and below 1
Sub Sample_Randomize
Dim aaa As Single
Dim bbb As Integer
' Initialization of random number seed
Randomize
For bbb = 1 to 5
' Generate a random number over 0 and below 1 and assign it to aaa
aaa = Rnd
' Display a random number on the message output window
PrintDbg aaa
Next
End Sub
ID : 292