RANDOMIZE [number]
Description
RANDOMIZE initializes the random-number generator. The optional parameter, number, is any valid numeric expression that is used as a seed for the RND function. If number is omitted, the value of the system timer is used as the seed value. To repeat a random-number sequence, call RND with a negative argument, then call RANDOMIZE with a numeric argument; calling RANDOMIZE alone with the same value for number will not repeat a sequence.
Example
REM RANDOMIZE Example
'RANDOMIZE initialize random-numbergenerator
RANDOMIZE
Random
RANDOMIZE 44
Random
RND -1
RANDOMIZE 169
Random
SUB Random
DIM Ret
RET = ""
FOR i = 1 to 4
RET = RET & INT((RND * 1000) + 1) & " "
NEXT
PRINT "Four random numbers:", RET
END SUB
Output
Four random numbers:8 912 43 537
Four random numbers:33 6 430 51
Four random numbers:36 6 192 54
Related Items
RND