Mersenne Twister reproducibility for all compilers

I am generating a sequence of random numbers with std :: mt19937_64. I noticed that when you run GCC and Clang on the same platform with the same seed, I get a different sequence. I ran the program through Valgrind and could not find uninitialized memory.

Is there any guarantee of reproducibility between compilers or on different platforms using std :: mt19937_64?

Edit: Run with std :: normal_distribution

+7
c ++ random c ++ - standard-library
source share
1 answer

The numbers that the engines generate are guaranteed to play in all implementations, but the distributions are not. (source: rand () is considered harmful ).

The standard project N3337 talks about normal_distribution (26.5.8.5.1):

The distribution of random numbers of the normal distribution distributes random numbers x distributed over the probability density function

enter image description here

The distribution parameters ฮผ and ฯƒ are also known as mean values โ€‹โ€‹of mean and standard deviation

And this. It does not determine the order of the generated numbers, neither the algorithm nor the approximate outputs.

The standard describes mersenne_twister_engine (26.5.3.2) in great detail, it indicates the state transition function, the initial sowing algorithm, etc.

+10
source share

All Articles