HELPLIB.HLB  —  CRTL  seed48
    Initializes a 48-bit random-number generator.

    Format

      #include  <stdlib.h>

      unsigned short *seed48  (unsigned short seed_16v[3]);

1  –  Argument

 seed_16v

    An array of three unsigned short ints that form a 48-bit seed
    value.

2  –  Description

    The seed48 function initializes the random-number generator.
    You can use this function in your program before calling the
    drand48, lrand48, or mrand48 functions. (Although it is not
    recommended practice, constant default initializer values are
    supplied automatically if you call drand48, lrand48, or mrand48
    without calling an initialization function).

    The seed48 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 initializer function seed48:

    o  Sets the value of Xi to the 48-bit value specified in the
       array pointed to by seed_16v.

    o  Returns a pointer to a 48-bit internal buffer that contains
       the previous value of Xi, used only by seed48.

    The returned pointer allows you to restart the pseudorandom
    sequence at a given point. Use the pointer to copy the previous
    Xi value into a temporary array. To resume where the original
    sequence left off, you can call seed48 with a pointer to this
    array.

    See also drand48, lrand48, and mrand48.

3  –  Return Value

    x                  A pointer to a 48-bit internal buffer.
Close Help