From 32fee1944772ba98f2c181e0a90221c09def78a7 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Fri, 22 Nov 2024 21:29:57 +0100 Subject: [PATCH] Fix linear congruential random number generator Fixes: #4146, #4148, #4270 Fixes: 2252936fc801 ("Use linear congruential random number generator [...]") Signed-off-by: Stefan Weil --- src/ccutil/helpers.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/ccutil/helpers.h b/src/ccutil/helpers.h index 212415020b..20a48201bb 100644 --- a/src/ccutil/helpers.h +++ b/src/ccutil/helpers.h @@ -68,7 +68,9 @@ inline const std::vector split(const std::string &s, char c) { return v; } -// A simple linear congruential random number generator. +// A simple linear congruential random number generator, +// using Knuth's constants from: +// http://en.wikipedia.org/wiki/Linear_congruential_generator. class TRand { public: // Sets the seed to the given value. @@ -95,7 +97,10 @@ class TRand { } private: - std::minstd_rand e; + std::linear_congruential_engine e; }; // Remove newline (if any) at the end of the string.