Library /sys$common/syshlp/helplib.hlb  —  CRTL  nrand48
    Generates uniformly distributed pseudorandom-number sequences.
    Returns 48-bit signed long integers.

    Format

      #include  <stdlib.h>

      long int nrand48  (unsigned short int xsubi[3]);

1  –  Argument

 xsubi

    An array of three short ints that, when concatenated together,
    form a 48-bit integer.

2  –  Description

    The nrand48 function generates pseudorandom numbers using the
    linear congruential algorithm and 48-bit integer arithmetic.

    The nrand48 function returns nonnegative, long integers uniformly
    distributed over the range of y values, such that 0 

    The function works by generating a sequence of 48-bit integer
    values, Xi, according to the linear congruential formula:

           Xn+1 = (aXn+c)mod m        n >= 0

    The argument m equals 248, so 48-bit integer arithmetic is

    performed. Unless you invoke the lcong48 function, the multiplier
    value a and the addend value c are:

          a = 5DEECE66D16 = 2736731631558

          c = B16 = 138

    The nrand48 function requires that the calling program pass an
    array as the xsubi argument, which for the first call must be
    initialized to the initial value of the pseudorandom-number
    sequence. Unlike the drand48 function, it is not necessary to
    call an initialization function prior to the first call.

    By using different arguments, the nrand48 function allows
    separate modules of a large program to generate several
    independent sequences of pseudorandom numbers. For example, the
    sequence of numbers that one module generates does not depend
    upon how many times the functions are called by other modules.

3  –  Return Value

    n                  Returns nonnegative, long integers over the
                       range 0 
Close Help