Randomize statement - MapBasic - 2023

MapInfo MapBasic Reference

Product type
Software
Portfolio
Locate
Product family
MapInfo
Product
MapInfo > MapBasic
Version
2023
Language
English
Product name
MapBasic
Title
MapInfo MapBasic Reference
First publish date
1985
Last updated
2023-09-12
Published on
2023-09-12T16:32:32.686312

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.

Example

Randomize

See Also:

Rnd() function