Replace random generator

This commit is contained in:
Alexander Batalov 2022-10-29 17:21:54 +03:00
parent 8ee0f478ad
commit 8dd8d1c312
1 changed files with 4 additions and 5 deletions

View File

@ -3,6 +3,8 @@
#include <limits.h>
#include <stdlib.h>
#include <random>
#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