How to: |
The PRDNOR and PRDUNI functions generate reproducible random numbers:
CMS behavior differs from z/OS behavior. In CMS, the seed changes upon multiple executions as the function is reloaded unless you reissue the DEFINE for each execution. In z/OS, the numbers do not reproduce.
{PRDNOR|PRDUNI}(seed, outfield)
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.
On CMS, the numbers reproduce only if the DEFINE that calls the function is reissued each time you run the request.
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
Information Builders |