How to get a new, independent, randomly initialized RNG



How can I get a randomly initialized RNG that is “independent” of Base.Random.GLOBAL_RNG (in the sense that I can use them in different threads in parallel)?

I thought of MersenneTwister(), but that is deprecated without an argument.



the way to do it?


It’s un-deprecated in 0.7. If you are on 0.6, an equivalent way is simply srand(MersenneTwister(0)). Equivalently, you can generate a random seed for MersenneTwister with e.g. seed = rand(RandomDevice(), UInt32, 4); rng = MersenneTwister(seed).

closed #3

This topic was automatically closed after 3 days. New replies are no longer allowed.