Random Numbers

Generating good quality random numbers is crucial for any Monte Carlo code. In addition to generating pseudo random numbers with good statistics and in minimal CPU time, we also have the requirement that computations should be reproducible and the random number sequences independent on each worker when the code runs in parallel mode.

We define the random number generator in the module ConsistentRNG.jl, which is loaded onto each process. Furthermore, independent seeds are used to seed the RNGs on each worker (from goQMC.jl). These seeds are generated using the Random.RandomDevice random number generator, which draws entropy from the operating system / hardware. The seeds are saved to file with a filename that includes the number of processes used. If a suitable file is found, then seeds are read in from the file. This behaviour can be controlled by the flag reuseRandomSeeds in the input file.

For the random number generator we are currently using 'Xoroshiro128Plus' from 'RandomNumbers.jl'. For benchmarks and statistical test results see the Documentation of RandomNumbers.jl.

Module ConsistentRNG.jl

Rimu.ConsistentRNG.cRandMethod
r = cRand(args...)

Similar to 'rand(args)' but uses consistent random number generator 'CRNGs'. 'cRand()' generates a single uniformly distributed random number in the interval [0,1). Currently we are using 'Xoshiro256StarStar' from 'RandomNumbers.jl', see the Documentation and this Blog post.

source
Rimu.ConsistentRNG.newChildRNGFunction
newChildRNG(parent_rng = trng())

Random number generator that is seeded deterministically from the thread-consistent global rng trng(). By scrambling with hash(), a statistically independent pseudo-random sequence from the parent rng is accessed.

source
Rimu.ConsistentRNG.seedCRNG!Method
seedCRNG!(seed)

Seed the threaded consistent random number generators CRNGs. If a single number is given, this will be used to seed a random sequence, which is hashed and then used to generate seeds for each rng in the vector TCRNG.

source
Rimu.ConsistentRNG.CRNGType

Baseline random number generator used throughout. Currently we are using 'Xoshiro256StarStar' from 'RandomNumbers.jl', see the Documentation and this Blog post. In order to change the random number generator, edit 'ConsistentRNG.jl'.

source