Randomize
The Randomize statement resets the random-number generator (used by the RND function) to a new seed value.
Comments and Examples
Obtaining its values from the system clock, RANDOMIZE uses an algorithm to determine a new seed value.
The following sequence of program lines prints ten random integers with values from 1 to 100. Line 1490 rescales the value of RND, which is always between 0 and 1, to a value in the 1 to 100 range. RANDOMIZE ensures that the series of values generated by the RND function will not be duplicated each time the program is run.
01470 RANDOMIZE 01480 FOR I=1 TO 10 01490 PRINT INT(RND*100+1) 01500 NEXT I
Syntax
RANDOMIZE
Technical Considerations
- When RANDOMIZE is not used, the RND function produces the same sequence of numbers each time Business Rules is loaded.