How to: |
Available Languages: reporting, Maintain
The PRDNOR and PRDUNI functions generate reproducible random numbers:
If PRDNOR generates a large set of numbers, they have the following properties:
{PRDNOR|PRDUNI}(seed, output)
where:
Generates reproducible double-precision random numbers normally distributed with an arithmetic mean of 0 and a standard deviation of 1.
Generates reproducible double-precision random numbers uniformly distributed between 0 and 1.
Numeric
Is the seed or the field that contains the seed, up to 9 digits. The seed is truncated to an integer.
On z/OS, the numbers do not reproduce.
Double-precision
Is the name of the field that contains the result, or the format of the output value enclosed in single quotation marks.
PRDNOR assigns random numbers and stores them in RAND. These values are then used to randomly pick five employee records identified by the values in the LAST NAME and FIRST NAME fields. The seed is 40. To produce a different set of numbers, change the seed.
DEFINE FILE EMPLOYEE RAND/D12.2 WITH LAST_NAME = PRDNOR(40, RAND);END
TABLE FILE EMPLOYEE PRINT LAST_NAME AND FIRST_NAME BY HIGHEST 5 RAND END
The output is:
RAND LAST_NAME FIRST_NAME ---- --------- ---------- 1.38 STEVENS ALFRED 1.12 MCCOY JOHN .55 SMITH RICHARD .21 JONES DIANE .01 IRVING JOAN