From bdc83bb1b87e46b7b89e9ec6e9cf3a0e8756cba6 Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Tue, 7 Nov 2023 23:48:12 +0200 Subject: [PATCH] Add description why minstd has been chosen --- lib/CRandomGenerator.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/CRandomGenerator.h b/lib/CRandomGenerator.h index 02974aaad..cb0360e60 100644 --- a/lib/CRandomGenerator.h +++ b/lib/CRandomGenerator.h @@ -14,6 +14,10 @@ VCMI_LIB_NAMESPACE_BEGIN +/// Generator to use for all randomization in game +/// minstd_rand is selected due to following reasons: +/// 1. Its randomization quality is below mt_19937 however this is unlikely to be noticeable in game +/// 2. It has very low state size, leading to low overhead in size of saved games (due to large number of random generator instances in game) using TGenerator = std::minstd_rand; using TIntDist = std::uniform_int_distribution; using TInt64Dist = std::uniform_int_distribution;