[20] | 1 | //! \file ranlux.h
|
---|
| 2 |
|
---|
| 3 | #ifndef __RANLUX_H__
|
---|
| 4 | #define __RANLUX_H__
|
---|
| 5 |
|
---|
| 6 | /* This is a lagged fibonacci generator with skipping developed by Luescher.
|
---|
| 7 | The sequence is a series of 24-bit integers, x_n,
|
---|
| 8 |
|
---|
| 9 | x_n = d_n + b_n
|
---|
| 10 |
|
---|
| 11 | where d_n = x_{n-10} - x_{n-24} - c_{n-1}, b_n = 0 if d_n >= 0 and
|
---|
| 12 | b_n = 2^24 if d_n < 0, c_n = 0 if d_n >= 0 and c_n = 1 if d_n < 0,
|
---|
| 13 | where after 24 samples a group of p integers are "skipped", to
|
---|
| 14 | reduce correlations. By default p = 199, but can be increased to
|
---|
| 15 | 365.
|
---|
| 16 |
|
---|
| 17 | The period of the generator is around 10^171.
|
---|
| 18 |
|
---|
| 19 | From: M. Luescher, "A portable high-quality random number generator
|
---|
| 20 | for lattice field theory calculations", Computer Physics
|
---|
| 21 | Communications, 79 (1994) 100-110.
|
---|
| 22 |
|
---|
| 23 | Available on the net as hep-lat/9309020 at http://xxx.lanl.gov/
|
---|
| 24 |
|
---|
| 25 | See also,
|
---|
| 26 |
|
---|
| 27 | F. James, "RANLUX: A Fortran implementation of the high-quality
|
---|
| 28 | pseudo-random number generator of Luscher", Computer Physics
|
---|
| 29 | Communications, 79 (1994) 111-114
|
---|
| 30 |
|
---|
| 31 | Kenneth G. Hamilton, F. James, "Acceleration of RANLUX", Computer
|
---|
| 32 | Physics Communications, 101 (1997) 241-248
|
---|
| 33 |
|
---|
| 34 | Kenneth G. Hamilton, "Assembler RANLUX for PCs", Computer Physics
|
---|
| 35 | Communications, 101 (1997) 249-253 */
|
---|
| 36 |
|
---|
| 37 | namespace siscone{
|
---|
| 38 |
|
---|
| 39 | /// initialize 'ranlux' generator
|
---|
| 40 | void ranlux_init();
|
---|
| 41 |
|
---|
| 42 | /// generate random value (24 bits)
|
---|
| 43 | unsigned long int ranlux_get();
|
---|
| 44 |
|
---|
| 45 | /// save state of the generator
|
---|
| 46 | void ranlux_print_state();
|
---|
| 47 |
|
---|
| 48 | }
|
---|
| 49 | #endif
|
---|