──RANDOM(─┬──────────────────────────┬─)──── ├─max──────────────────────┤ ├─min,─┬─┬─────┬─┬───────┬─┘ └─,────┘ └─max─┘ └─,seed─┘
RANDOM returns a quasi-random, nonnegative whole number in the range min to max inclusive. If only one argument is specified, the range will be from 0 to that number. Otherwise, the default values for min and max are 0 and 999, respectively. A specific seed (which must be a whole number) for the random number can be specified as the third argument if repeatable results are desired.
The magnitude of the range (that is, max minus min) must not exceed 100000.
Here are some examples:
RANDOM() -> 305 RANDOM(5,8) -> 7 RANDOM(,,1983) -> 123 /* reproducible */ RANDOM(2) -> 0
Notes:
sequence = RANDOM(1,6,12345) /* any number would */ /* do for a seed */ do 39 sequence = sequence RANDOM(1,6) end say sequence
The numbers are generated mathematically, using the initial seed,
so that as far as possible they appear to be random. Running the program
again will produce the same sequence; using a different initial seed
almost certainly produces a different sequence.