How to: |
The RDNORM and RDUNIF functions generate random numbers:
If RDNORM generates a large set of numbers (between 1 and 32768), they have the following properties:
{RDNORM|RDUNIF}(output)
where:
Generates double-precision random numbers normally distributed with an arithmetic mean of 0 and a standard deviation of 1.
Generates double-precision random numbers uniformly distributed between 0 and 1.
Double-precision
Is the name of the field that contains the result, or the format of the output value enclosed in single quotation marks.
RDNORM assigns random numbers and stores them in RAND. These numbers are then used to randomly choose five employee records identified by the values in the LAST NAME and FIRST NAME fields.
DEFINE FILE EMPLOYEE
RAND/D12.2 WITH LAST_NAME = RDNORM(RAND);
END
TABLE FILE EMPLOYEE
PRINT LAST_NAME AND FIRST_NAME
BY HIGHEST 5 RAND
END
The request produces output similar to the following:
RAND LAST_NAME FIRST_NAME ---- --------- ---------- .65 CROSS BARBARA .20 BANNING JOHN .19 IRVING JOAN .00 BLACKWOOD ROSEMARIE -.14 GREENSPAN MARY
Information Builders |