1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00

Add description why minstd has been chosen

This commit is contained in:
Ivan Savenko 2023-11-07 23:48:12 +02:00 committed by GitHub
parent 414c25ea49
commit bdc83bb1b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,6 +14,10 @@
VCMI_LIB_NAMESPACE_BEGIN 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 TGenerator = std::minstd_rand;
using TIntDist = std::uniform_int_distribution<int>; using TIntDist = std::uniform_int_distribution<int>;
using TInt64Dist = std::uniform_int_distribution<int64_t>; using TInt64Dist = std::uniform_int_distribution<int64_t>;