From 8dd8d1c312aca775c322d8cc0eef7099b23e214c Mon Sep 17 00:00:00 2001 From: Alexander Batalov Date: Sat, 29 Oct 2022 17:21:54 +0300 Subject: [PATCH] Replace random generator --- src/random.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) 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