/sys$common/syshlp/HELPLIB.HLB  —  CRTL  initstate  Description
    The initstate function initializes random-number generators. It
    lets you initialize, for future use, a state array passed as an
    argument. The size, in bytes, of the state array is used by the
    initstate function to decide how sophisticated a random-number
    generator to use; the larger the state array, the more random the
    numbers.

    Values for the amount of state information are 8, 32, 64, 128,
    and 256 bytes. Amounts less than 8 bytes generate an error, while
    other amounts are rounded down to the nearest known value.

    The seed argument specifies a starting point for the random-
    number sequence and provides for restarting at the same point.
    The initstate function returns a pointer to the previous state
    information array.

    Once you initialize a state, the setstate function allows rapid
    switching between states. The array defined by the state argument
    is used for further random-number generation until the initstate
    function is called or the setstate function is called again. The
    setstate function returns a pointer to the previous state array.

    After initialization, you can restart a state array at a
    different point in one of two ways:

    o  Use the initstate function with the desired seed argument,
       state array, and size of the array.

    o  Use the setstate function with the desired state, followed by
       the srandom function with the desired seed. The advantage of
       using both functions is that you do not have to save the state
       array size once you initialize it.

    See also setstate, srandom, and random.
Close Help