HP OpenVMS Systems

ask the wizard
Content starts here

Random Number Functions, Algorithms?

» close window

The Question is:

rand() function callable by C or FORTRAN.
Has the random number generator embedded within OpenVMS ever been certified by
 an independednt organization? If so, who?
Question is asked because of a proposal our company is responding to. The
 customer requires independent certification of any RNG employed. Thanks!

The Answer is :

    The underlying (pseudo) random number generator for most random-number
    requests MTH$RANDOM. It uses a mixed congruential algorithm:
      Seed = (69069 * seed +1) MOD 2**32
    This algorithm is as described in the literature, most notably in Knuth
    "The Art of Computer Programming", Volume 2 "Seminumerical Algortithms"
    The choice of multiplier is taken from
    "Random Number Generation" by G. Marsaglia in:
    Encyclopedia of Computer Science (pp. 1192-1197)
    edited by Anthony Ralston, Petrocelli (New York, 1976)
    As with all algorithms, this method is a compromise between speed of
    execution and the quality of the generated pseudo random sequences.
    There are numerous papers in the literature which perform deep
    statistical analysis of various choices of algorithm. This particular
    choice has stood the test of time and remains the best choice in its
    class for a general purpose uniform distribution generator. It's very
    fast and produces quite good sequences of numbers.
    A Google search for "MTH$RANDOM" finds plenty of references. A full
    literature search may find more (academic statisticians love to pick
    holes in commercial random number generators).
    There are some applications which require "better" random sequences
    ("better" defined as passing more stringent statistical tests of
    randomness). There are algorithms which satisfy these critera, but
    they require more computation, and are therefore slower.
    If you have a special requirement for pseudo random number generation,
    you should replace the standard generator. There are huge numbers of
    algorithms available either commercially or published in the literature.
    It's just a matter of selecting one that satisfies your exact needs.
    Specifically with the C rand() function, the algorithm is documented
      static unsigned int next = 1;
      int rand(void)
        next = next * 1103515245 + 12345;
        return (next & RAND_MAX);
    The actual implementation of rand() is slightly complicated, given
    the need for reentrancy.

answer written or last revised on ( 10-SEP-2004 )

» close window