I'm generating 2D terrain with 1D perlin noise using Mersenne Twister to for random numbers. My first thought was using Mersenne Twister will give me always the same results with same seed on any given hardware. But when I compare the values/terrain on different devices it gives me different results. (It worked for IOS, OSX and MAC, but not for WP8).
Code:
class 1DNoiseTest
{
typedef std::mt19937 MyRNG;
MyRNG rng;
1DNoiseTest( unsigned seed )
{
rng.seed(seed);
std::uniform_real_distribution<double> distribution(0.0,1.0);
for ( unsigned i = 0; i < kMaxVertices; ++i )
{
r[ i ] = ( distribution(rng)); error
}
}
...
Am I misunderstanding Mersenne Twister or am I doing something wrong? How could I get the same terrain/values on every device/hardware?
Thanks for your time!
See this question:
C++11 cross compiler/standard library random distribution reproducibility
std::uniform_real_distribution is not guaranteed to give same results across different compilers.