V115: Uniform Random Numbers of Guaranteed Quality

Author(s): F. James Library: MATHLIB
Submitter: Submitted: 15.03.1994
Language: Fortran Revised:

RANLUX generates pseudorandom numbers uniformly distributed in the interval (0,1), the end points excluded. Each call produces an array of single-precision real numbers of which 24 bits of mantissa are random. The user can choose a luxury level which guarantees the quality required for his application. The lowest luxury level (zero) gives a fast generator which will fail some sophisticated tests of randomness; The highest level (four) is about five times slower but guarantees complete randomness. In all cases the period is greater than tex2html_wrap_inline113 . Independent subsequences can be generated. Entries are provided for initialization and checkpointing.

Structure:

SUBROUTINE Subprograms
User Entry Names: RANLUX, RLUXGO, RLUXAT, RLUXIN, RLUXUT

Usage:

    CALL RANLUX(RVEC,LEN)
returns a vector RVEC of LEN 32-bit random floating point numbers in the interval (0,1), the end points excluded. RVEC is an array of type REAL and of length LEN at least.

Luxury levels:

For simplicity, five standard luxury levels may be chosen (t is the time factor relative to level zero; for the definition of p, see References). Ref. 1. explains the method, Ref. 2. describes the Fortran implementation in more detail.

Level

p t
0 24 1 tex2html_wrap141
1 48 1.5 tex2html_wrap143
2 97 2 tex2html_wrap145
3 223 3 tex2html_wrap147
4 389 5 tex2html_wrap149

As a rough indication of timing, RNDM (V104) is about t=0.5, RANMAR (V113) t=1, and RANECU (V114) t=2. Concerning the quality scale, RNDM is maybe good enough for moving fish around on a screen saver (if you are not afraid of getting some diagonal lines on your screen), RANMAR and RANECU both have quality which probably corresponds to a luxury level between 1 and 2, but this is based only on empirical testing and true quality may be lower.

No initialization is necessary if the user wants default values. Otherwise the following are available:

    CALL RLUXGO(LUX,INT,K1,K2)
When tex2html_wrap_inline129 , this call initializes the RANLUX generator from one 32-bit integer INT and sets the Luxury Level. If LUX is an integer between 0 and 4, it sets the luxury level as defined above. If tex2html_wrap_inline131 , it is taken as the value of p, which then can take on other values than those given in the table. If tex2html_wrap_inline135 , default initialization is used and only the luxury level is set by LUX. Otherwise, every possible value of INT gives rise to a valid, independent sequence which will not overlap any sequence initialized with any other value of INT. The integers K1 and K2 are used for restarting the generator from a break point saved by RLUXAT.
    CALL RLUXAT(LUX,INT,K1,K2)
dumps the four integers which can be used to restart the generator at this point by calling RLUXGO. RANLUX will then skip over tex2html_wrap_inline137 numbers to reach the break point. A more efficient but less convenient method for restarting is offered by RLUXIN and RLUXUT.
    CALL RLUXIN(IVEC)
restarts the generator from vector IVEC of 25 32-bit integers (see RLUXUT). IVEC is an array of type INTEGER and of length 25 at least.
    CALL RLUXUT(IVEC)
outputs the current values of the 25 32-bit integer seeds, to be used for restarting.

References:

  1. M. Lüscher, A portable high-quality random number generator for lattice field theory simulations, Computer Phys. Commun. 79 (1994), 100-110.
  2. F. James, RANLUX: A Fortran implementation of the high-quality pseudorandom number generator of Lüscher, Computer Phys. Commun. 79 (1994) 111-114.
tex2html_wrap_inline139



Michel Goossens Wed Jun 5 08:39:19 METDST 1996