Rational Developer for System z
Enterprise PL/I for z/OS, Version 3.8, Language Reference Manual

RANDOM

RANDOM returns a FLOAT BINARY(53) random number generated using x as the given seed. If x is omitted, the random number generated is based on the seed provided by the last RANDOM invocation with a seed, or on a default initial seed of 1 if RANDOM has not previously been invoked with a seed.

Read syntax diagramSkip visual syntax diagram>>-RANDOM--+-----+---------------------------------------------><
           '-(x)-'
 
x
Expression. x must have a computational type and should have an arithmetic type. If x is numeric, it must be real. If x is not specified FIXED BINARY(31,0), it is converted.

Unless 0 < x < 2,147,483,646, the ERROR condition is raised.

The values generated by RANDOM are uniformly distributed between 0 and 1, with 0 < random(x) < 1. They are generated as follows using the multiplicative congruential method:

  seed(x) = mod(950706376 * seed(x - 1), 2147483647)
  random(x) = seed(x) / 2147483647

The seed is maintained at the program level and not within each thread in a multithreading application.


Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)