Is it guaranteed by the standard that if std::mt19937
was seeded by the same number, it will produce the same sequence of numbers on all platforms?
In other words, is its implementation well-defined by the standard or it is like std::rand()
which was considered as implementation details?
In [rand.eng.mars] 1-5 the passage basically sums up the implementation details for the mersenne twister algorithm.
std::mt19937
is just a typedef for
using mt19937 =
mersenne_twister_engine<uint_fast32_t,
32,624,397,31,0x9908b0df,11,0xffffffff,7,0x9d2c5680,15,0xefc60000,18,1812433253>;
And all the standard says about the expected results is that :
Required behavior: The 10000 th consecutive invocation of a default-constructed object of type mt19937 shall produce the value 4123659995.
No other guarantees are made.
However, because the std::mersenne_twister_engine
is required to follow the mersenne twister PRNG implementation it's implementation is well defined.