Best way to seed mt19937_64 for Monte Carlo simulations

Use std::random_device to generate the seed. It’ll provide non-deterministic random numbers, provided your implementation supports it. Otherwise it’s allowed to use some other random number engine. std::mt19937_64 prng; seed = std::random_device{}(); prng.seed(seed); operator() of std::random_device returns an unsigned int, so if your platform has 32-bit ints, and you want a 64-bit seed, you’ll need to … Read more

How can I retrieve the current seed of NumPy’s random number generator?

The short answer is that you simply can’t (at least not in general). The Mersenne Twister RNG used by numpy has 219937-1 possible internal states, whereas a single 64 bit integer has only 264 possible values. It’s therefore impossible to map every RNG state to a unique integer seed. You can get and set the … Read more