diff --git a/src/random.cc b/src/random.cc index 427679e..82f47b3 100644 --- a/src/random.cc +++ b/src/random.cc @@ -3,6 +3,8 @@ #include #include +#include + #include "debug.h" #include "platform_compat.h" #include "scripts.h" @@ -37,7 +39,7 @@ static int _idum; void randomInit() { unsigned int randomSeed = randomGetSeed(); - srand(randomSeed); + std::srand(randomSeed); int pseudorandomSeed = randomInt32(); randomSeedPrerandomInternal(pseudorandomSeed); @@ -183,10 +185,7 @@ void randomSeedPrerandom(int seed) // 0x4A31C4 static int randomInt32() { - int high = rand() << 16; - int low = rand(); - - return (high + low) & INT_MAX; + return std::rand(); } // 0x4A31E0