forked from Mirrors/openclonk
Merge remote-tracking branch 'origin/master' into liquid_container
commit
7d5d97b0d6
|
@ -160,4 +160,10 @@ global func GetSurfaceVector(int x, int y)
|
||||||
}
|
}
|
||||||
|
|
||||||
return normal;
|
return normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Proper modulo operation.
|
||||||
|
global func Mod(a, b)
|
||||||
|
{
|
||||||
|
return (a % b + b) % b;
|
||||||
|
}
|
||||||
|
|
|
@ -21,14 +21,21 @@
|
||||||
#include "lib/C4Random.h"
|
#include "lib/C4Random.h"
|
||||||
#include "control/C4Record.h"
|
#include "control/C4Record.h"
|
||||||
|
|
||||||
|
#include <random>
|
||||||
#include <pcg/pcg_random.hpp>
|
#include <pcg/pcg_random.hpp>
|
||||||
|
|
||||||
int RandomCount = 0;
|
int RandomCount = 0;
|
||||||
static pcg32 RandomRng, UnsyncedRandomRng;
|
|
||||||
|
static pcg32 SeededRng()
|
||||||
|
{
|
||||||
|
pcg_extras::seed_seq_from<std::random_device> seed_source;
|
||||||
|
return pcg32(seed_source);
|
||||||
|
}
|
||||||
|
|
||||||
|
static pcg32 RandomRng, UnsyncedRandomRng = SeededRng();
|
||||||
|
|
||||||
void FixedRandom(uint64_t seed)
|
void FixedRandom(uint64_t seed)
|
||||||
{
|
{
|
||||||
UnsyncedRandomRng.seed(seed);
|
|
||||||
RandomRng.seed(seed);
|
RandomRng.seed(seed);
|
||||||
RandomCount = 0;
|
RandomCount = 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue