Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Will std::mt19937 (Mersenne Twister) return the same sequence of numbers?

This thread is locked; no one can reply to it. rss feed Print
Will std::mt19937 (Mersenne Twister) return the same sequence of numbers?
Mark Oates
Member #1,146
March 2001
avatar

Will std::mt19937 (Mersenne Twister) return the same sequence of numbers regardless of platform if given the same seed?

I'm thinking the answer is yes, just wanting to confirm? :)

Rodolfo Lam
Member #16,045
August 2015

In theory it should work the same on all platforms that stick to the standard. That is why C++11 included the new random header file.

In the past rand() was not properly documented in the specification so there were no guarantees of replication even between same compiler versions. It is still that way though ;D

As long as you use only standard C++11 random facilities you should be safe, don't use rand().

Go to: