I would like to find out the largest value I can seed a random number generator in c++. My code is as follows:
mt19937 myRandomGenerator(seed);
How large can the variable, seed be? I have noticed that if the value becomes too large, the random number generator spits out the same sequence of 'random' numbers. I would like to know how large the seed can be without this happening.
seed
isstd::uint_fast32_t
which is usually just a 32-bit int. Every value in the range[0..2^32)
should produce different results. If you are seeing the same sequence from two different seed values, then you are either making an observational error and the seed you are inputing is actually the same, or there is a bug in your standard library implementation.Prepare a short self-contained test program demonstrating the misbehaviour and post it here.