From 58ae3316090413a402e3bdb3f45abd4582bf352e Mon Sep 17 00:00:00 2001 From: Azaezel Date: Wed, 9 Sep 2015 15:22:19 -0500 Subject: [PATCH] U32 MRandomLCG::randI() was using longs 32 and 64 bit windows can handle that. 64 bit linux no likey mixing longs and ints. --- Engine/source/math/mRandom.cpp | 4 ++-- Engine/source/math/mRandom.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Engine/source/math/mRandom.cpp b/Engine/source/math/mRandom.cpp index 7e808d7ac..021b161e2 100644 --- a/Engine/source/math/mRandom.cpp +++ b/Engine/source/math/mRandom.cpp @@ -88,13 +88,13 @@ void MRandomLCG::setSeed(S32 s) U32 MRandomLCG::randI() { if ( mSeed <= msQuotient ) - mSeed = (mSeed * 16807L) % S32_MAX; + mSeed = (mSeed * 16807) % S32_MAX; else { S32 high_part = mSeed / msQuotient; S32 low_part = mSeed % msQuotient; - S32 test = (16807L * low_part) - (msRemainder * high_part); + S32 test = (16807 * low_part) - (msRemainder * high_part); if ( test > 0 ) mSeed = test; diff --git a/Engine/source/math/mRandom.h b/Engine/source/math/mRandom.h index dbe5ad970..632925228 100644 --- a/Engine/source/math/mRandom.h +++ b/Engine/source/math/mRandom.h @@ -54,7 +54,7 @@ public: inline F32 MRandomGenerator::randF() { // default: multiply by 1/(2^31) - return F32(randI()) * (1.0f/2147483647.0f); + return F32(randI()) * (1.0f / S32_MAX); } inline S32 MRandomGenerator::randI(S32 i, S32 n)