/sys$common/syshlp/HELPLIB.HLB  —  CRTL  drand48
    Generates uniformly distributed pseudorandom-number sequences.
    Returns 48-bit, nonnegative, double-precision floating-point
    values.

    Format

      #include  <stdlib.h>

      double drand48  (void);

1  –  Description

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

    It returns nonnegative, double-precision, floating-point values
    uniformly distributed over the range of y values such that 0.0 
    y < 1.0.

    Before you call drand48, use either srand48, seed48, or lcong48
    to initialize the random-number generator. You must initialize
    prior to invoking the drand48 function because it stores the last
    48-bit Xi generated into an internal buffer. (Although it is not
    recommended, constant default initializer values are supplied
    automatically if the drand48, lrand48, or mrand48 functions are
    called without first calling an initialization function.)

    The drand48 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 lcong48, the multiplier value a
    and the addend value c are:

         a = 5DEECE66D16 = 2736731631558

         c = B16 = 138

    The values returned by drand48 are computed by first generating
    the next 48-bit Xi in the sequence. Then the appropriate bits,
    according to the type of returned data item, are copied from the
    high-order (most significant) bits of Xi and transformed into the
    returned value.

    See also srand48, seed48, lcong48, lrand48, and mrand48.

2  –  Return Value

    n                  A nonnegative, double-precision, floating-
                       point value.
Close Help