Generating Pseudorandom Numbers in Multithreaded Applications
If multiple threads in your application are generating sequences of values using PRNGs, then you want to ensure that there’s no chance that these sequences contain values that coincide with each other, especially if they’re using the same PRNG algorithm. (You would want to use the same PRNG algorithm to ensure that all your application’s pseudorandom number sequences have the same statistical properties.) Splittable, jumpable, and leapable PRNGs are ideal for this; they can create a stream of generators that have the same statistical properties and are statistically independent.
There are two techniques you can use to incorporate PRNGs into your applications. You can dynamically create a new generator when an application needs to fork a new thread. Alternatively, you can create a stream of RandomGenerator objects based on an initial RandomGenerator, then map each RandomGenerator object from the stream to its own thread.