The $RANDOM function returns a random integer from a range specified by its argument.
The format for the $RANDOM function is:
$R[ANDOM](intexpr)
The integer expression specifies the upper exclusive limit of a range of integers from which $RANDOM() may pick a result; $RANDOM() never returns a number less than zero (0).
If $RANDOM() has an argument less than one (1), it generates a run-time error.
$RANDOM can generate numbers up to 2147483646 (that is 2GB - 2).
$RANDOM() provides a tool for generating pseudo-random patterns useful in testing or statistical calculations. $RANDOM() results fall between zero (0) and one less than the argument.
Random number generators use factors from the environment to create sequences of numbers. True random number generation requires a source of what is known as "noise". Pseudo-random numbers appear to have no pattern, but are developed using interactions between factors that vary in ways not guaranteed to be entirely random. In accordance with the M standard, the GT.M implementation of $RANDOM() produces pseudo-random numbers.