17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-01 14:53:30 +01:00

seed the random engines from the system pool, not std::random_device

This commit is contained in:
maj00r
2026-09-14 17:34:59 +02:00
parent c3007e3237
commit ff3daea78c
5 changed files with 53 additions and 10 deletions

View File

@@ -62,6 +62,17 @@ inline long Round(double const f)
double Random(double a, double b);
int Random(int min, int max);
// Seed for the random engines: the clock, plus a counter so two engines seeded in
// the same second do not come out the same.
std::uint32_t clock_seed();
// The seed a word stands for. A number is taken as it is written; anything else is
// hashed the way Java's String.hashCode does it, so the same word gives the same
// world on every platform and every build - which is the whole point of telling
// somebody a seed.
std::uint32_t seed_of(std::string const &Text);
std::string generate_uuid_v4();
double LocalRandom(double a, double b);