1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-12-01 23:12:49 +02:00

Replaced most of usages of CRandomGenerator with vstd::RNG in library

This commit is contained in:
Ivan Savenko
2024-06-01 15:28:17 +00:00
parent 60a51e98de
commit 63bcf7d83c
125 changed files with 620 additions and 409 deletions

View File

@@ -20,9 +20,31 @@ class DLL_LINKAGE RNG
public:
virtual ~RNG() = default;
/// Returns random number in range [lower, upper]
virtual int nextInt(int lower, int upper) = 0;
/// Returns random number in range [lower, upper]
virtual int64_t nextInt64(int64_t lower, int64_t upper) = 0;
/// Returns random number in range [lower, upper]
virtual double nextDouble(double lower, double upper) = 0;
/// Returns random number in range [0, upper]
virtual int nextInt(int upper) = 0;
/// Returns random number in range [0, upper]
virtual int64_t nextInt64(int64_t upper) = 0;
/// Returns random number in range [0, upper]
virtual double nextDouble(double upper) = 0;
/// Generates an integer between 0 and the maximum value it can hold.
/// Should be only used for seeding other generators
virtual int nextInt() = 0;
/// Returns integer using binomial distribution
/// returned value is number of successfull coin flips with chance 'coinChance' out of 'coinsCount' attempts
virtual int nextBinomialInt(int coinsCount, double coinChance) = 0;
};
}