I am try to run this code:
#include <iostream>
#include <random>
void foo() {
std::random_device rd;
std::mt19937 mt(rd());
std::uniform_real_distribution<double> prob(0, 1);
std::cout << prob(mt) << '\n';
}
int main() {
for (int i = 0; i < 5; ++i) {
foo();
}
return 0;
}
At the mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64 I get this result:
0.726249
0.726249
0.726249
0.726249
0.726249
But on the ideone and g++ I get different numbers. So what the problem?