18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-21 14:24:58 +01:00

Improve random engine entropy and clean up random engine initialization

This commit is contained in:
2026-09-14 19:26:24 +02:00
parent 1c2f397fc5
commit 788135cc2d
4 changed files with 23 additions and 13 deletions

View File

@@ -63,9 +63,10 @@ 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();
/// @author lxvia
/// @brief Returns a random seed from the system's entropy source, if available. Otherwise, falls back to a clock-based seed.
/// @return A random seed as 64 bit unsigned integer
std::uint64_t true_random_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