1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-09 01:06:07 +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

@ -46,18 +46,23 @@ public:
/// Generates an integer between 0 and upper.
/// requires: 0 <= upper
int nextInt(int upper);
int nextInt(int upper) override;
int64_t nextInt64(int64_t upper) override;
/// requires: lower <= upper
int nextInt(int lower, int upper) override;
int64_t nextInt64(int64_t lower, int64_t upper) override;
/// Generates an integer between 0 and the maximum value it can hold.
int nextInt();
int nextInt() override;
///
int nextBinomialInt(int coinsCount, double coinChance) override;
/// Generates a double between 0 and upper.
/// requires: 0 <= upper
double nextDouble(double upper);
double nextDouble(double upper) override;
/// requires: lower <= upper
double nextDouble(double lower, double upper) override;
@ -66,9 +71,6 @@ public:
/// seed a combination of the thread ID and current time in milliseconds will be used.
static CRandomGenerator & getDefault();
/// Provide method so that this RNG can be used with legacy std:: API
TGenerator & getStdGenerator();
private:
TGenerator rand;