Multithreaded RNG access

Started by
9 comments, last by LorenzoGatti 6 years, 11 months ago

Having a single random number generator provides some guarantees on the randomness[1], having several random number generators could introduce correlations between drawn numbers. (Due to the fact we normally use pseudo-random number generators rather than true (hardware) generators.)

If each thread processes a different and time-varying number of particles, their PRNGs are going to lose correlation very fast even if they start from the same seed, and you can ensure a good start by simply initializing each thread's PRNG with a different random or pseudorandom seed.
If you are not interested in reproducibility and really paranoid, each worker thread could also reseed its PRNG periodically (or aperiodically) from shared read-only random data (e.g. /dev/urandom on Linux, CryptGenRandom() etc. on Windows)

Omae Wa Mou Shindeiru

This topic is closed to new replies.

Advertisement