Purpose
Initializes MapBasic's random number function. You can issue this statement from the MapBasic window in MapInfo Pro.
Syntax
Randomize [ With seed ]
seed is an integer expression.
Description
The Randomize statement "seeds" the random number generator so that later calls to the Rnd() function produce random results. Without this statement before the first call to the Rnd() function, the actual series of random numbers will follow a standard list. In other words, unless the program includes a Randomize statement, the sequence of values returned by the Rnd() function will follow the same pattern each time the application is run.
The Randomize statement is only needed once in a program and should occur prior to the first call to the Rnd() function.
If you include the With clause, the seed parameter is used as the seed value for the pseudo-random number generator. If you omit the With clause, MapBasic automatically seeds the pseudo-random number generator using the current system clock. Use the With clause if you need to create repeatable test scenarios, where your program generates repeatable sequences of "random" numbers.