Subject: Random number generator for QMC

From: [email-masked] (Brian Hammond)
Date: Wed, 15 Mar 95 10:11:51 PST

Dave Young writes:

>Hello,
>
>        I am starting to do Quantum Monte Carlo calculations and
>I am interested in the performance of random number generators.
>
>        There have been a number of tests developed, the most trusted
>seem to be those in "Seminumerical Algorithms" by Knuth.  And there
>are a number of supplemental random number generators, such as the
>ran3 generator in "Numerical Recipies".  It has also been demonstrated
>that in the past the random number generators built into various 
>programming languages were not to be trusted.
>
>        My question is - Do the random number generators built into
>the current generation of compilers pass statistical tests?
>
>        I have tested the built in random number generators in
>Borland C++ and GNU C++ and so far they have passed all tests
>(working out of Knuth).  I would like to know if it is only C++ that
>has a reliable random number generator implemented or if all
>compilers are now reliable, or if it is only certain vendors even within
>the C++ language?
>
>        The reason that I would like to use built in random number
>generators is that Knuth indicates that code written directly in 
>assembly language can accomplish the task faster than code written in
>standard source code.  The GNU C++ built in random number generator
>is a factor of 2 faster than the ran3 generator using all available
>compiler optimization.
>
>
>                                Dave Young
>                                [email-masked]
>                                youngdc@msucem
>

For QMC calculations the "quality" of pseudo-random numbers depends on the
algorithm used. Most modern Fortran- or C-library pseudo-random number
generators are good enough, particularly if you are doing branching
in which you are using a random number of pseudo-random numbers. 
Also you must consider how to create Gaussian distributed random 
numbers if your algorithm calls for them. I have seen presentations
where the overall cycle length of the underlying pseudo-random number
generator is quite noticeable due to creating Gaussian numbers by
adding 12 uniformly distributed numbers. 

So, in general use a pseudo-random number generator with a long
cycle length and use Box-Muller if you want Gaussian pseudo-random numbers.

-Brian

======================================================================== 
Brian L. Hammond                 _/_/_/_/    _/_/_/    _/_/_/_/_/   
Computational Research Div.     _/        _/      _/      _/
Fujitsu America, Inc.          _/_/_/    _/_/_/_/_/      _/
3055 Orchard Drive            _/        _/      _/      _/
San Jose, CA  95134          _/        _/      _/  _/_/_/_/_/
Tel: (408) 456-7322
Email: [email-masked]