The RANDOM function returns a numeric value that is a pseudo-random number (one of a sequence of numbers generated by an algorithm
so as to have an even distribution over a range of values and minimal correlation between successive values) from a rectangular
distribution. The type of this function is numeric.
Usage
FUNCTION RANDOM [(argument-1)]
Parameters
- If
argument-1 is specified, it must be zero or a positive integer. It is used as the seed value to generate a sequence of pseudo-random
numbers.
- If a subsequent reference specifies
argument-1, a new sequence of pseudo-random numbers is started.
- If the first reference to this function in the run unit does not specify
argument-1, a seed value will be provided by the runtime.
- In each case, subsequent references without specifying
argument-1 return the next number in the current sequence.
Returned Values
- The returned value is greater than or equal to zero and less than one.
- For a given seed value on a given implementation, the sequence of pseudo-random numbers will always be the same.
Example
77 random_num pic s9(4)v99.
...
move function random() to random_num.