Replace random generator
This commit is contained in:
parent
8ee0f478ad
commit
8dd8d1c312
|
@ -3,6 +3,8 @@
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include <random>
|
||||||
|
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "platform_compat.h"
|
#include "platform_compat.h"
|
||||||
#include "scripts.h"
|
#include "scripts.h"
|
||||||
|
@ -37,7 +39,7 @@ static int _idum;
|
||||||
void randomInit()
|
void randomInit()
|
||||||
{
|
{
|
||||||
unsigned int randomSeed = randomGetSeed();
|
unsigned int randomSeed = randomGetSeed();
|
||||||
srand(randomSeed);
|
std::srand(randomSeed);
|
||||||
|
|
||||||
int pseudorandomSeed = randomInt32();
|
int pseudorandomSeed = randomInt32();
|
||||||
randomSeedPrerandomInternal(pseudorandomSeed);
|
randomSeedPrerandomInternal(pseudorandomSeed);
|
||||||
|
@ -183,10 +185,7 @@ void randomSeedPrerandom(int seed)
|
||||||
// 0x4A31C4
|
// 0x4A31C4
|
||||||
static int randomInt32()
|
static int randomInt32()
|
||||||
{
|
{
|
||||||
int high = rand() << 16;
|
return std::rand();
|
||||||
int low = rand();
|
|
||||||
|
|
||||||
return (high + low) & INT_MAX;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 0x4A31E0
|
// 0x4A31E0
|
||||||
|
|
Loading…
Reference in New Issue