Following a user's report on the use of random generators with MPI, this PR corrects 2 points:
The reset_rng(rank=0, seed=n) function, used for seeding the generators, behaved oddly and was not clearly documented. Up to now, the function needed to provide explicitly the MPI process rank to initialise correctly the process-specific generator (the so-called "thread" generator). Forgetting this resulted in all threads using the same random stream. Now by default, reset_rng now uses the actual rank, so that the rank argument can be omitted. The documentation is improved.
The Gaussian generator used static variables to store values between successive calls. This could introduce correlations between the "common" and "thread" random streams. Static variables are now eliminated.
Following a user's report on the use of random generators with MPI, this PR corrects 2 points:
reset_rng(rank=0, seed=n)
function, used for seeding the generators, behaved oddly and was not clearly documented. Up to now, the function needed to provide explicitly the MPI process rank to initialise correctly the process-specific generator (the so-called "thread" generator). Forgetting this resulted in all threads using the same random stream. Now by default,reset_rng
now uses the actual rank, so that the rank argument can be omitted. The documentation is improved.