Merge remote-tracking branch 'origin/master' into liquid_container

liquid_container
Mark 2016-05-01 19:43:10 +02:00
commit 7d5d97b0d6
2 changed files with 16 additions and 3 deletions

View File

@ -160,4 +160,10 @@ global func GetSurfaceVector(int x, int y)
}
return normal;
}
}
// Proper modulo operation.
global func Mod(a, b)
{
return (a % b + b) % b;
}

View File

@ -21,14 +21,21 @@
#include "lib/C4Random.h"
#include "control/C4Record.h"
#include <random>
#include <pcg/pcg_random.hpp>
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)
{
UnsyncedRandomRng.seed(seed);
RandomRng.seed(seed);
RandomCount = 0;
}