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

    Format

      #include  <stdlib.h>

      void srand48  (long int seed_val);

1  –  Argument

 seed_val

    The initialization value to begin randomization. Changing this
    value changes the randomization pattern.

2  –  Description

    The srand48 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 automatically
    supplied if you call drand48, lrand48, or mrand48 without calling
    an initialization function).

    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 initializer function srand48 sets the high-order 32 bits
    of Xi to the low-order 32 bits contained in its argument. The
    low-order 16 bits of Xi are set to the arbitrary value 330E16.

    See also drand48, lrand48, and mrand48.
Close Help