diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2024-08-02 11:53:59 +1000 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2024-08-02 11:53:59 +1000 |
commit | 497c6efc5555f3c45b7e092b461f39a3d89de865 (patch) | |
tree | 9289d4e9e55932f1205a1991d65af5732253c135 /source/core/StarRandom.hpp | |
parent | 53c4dc34911f0039cb1399048c231136696fe413 (diff) |
Fix RNG bugs from upgrade to C++17
staticRandomShuffle now uses its own tiny impl of the deprecated std::random_shuffle, producing identical results in testing
Diffstat (limited to 'source/core/StarRandom.hpp')
-rw-r--r-- | source/core/StarRandom.hpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/source/core/StarRandom.hpp b/source/core/StarRandom.hpp index a67a2c5..6afb2ad 100644 --- a/source/core/StarRandom.hpp +++ b/source/core/StarRandom.hpp @@ -208,8 +208,8 @@ typename Container::value_type Random::randValueFrom( template <typename Container> void Random::shuffle(Container& container) { - size_t max = container.size(); - std::shuffle(container.begin(), container.end(), URBG<size_t>([max]() { return Random::randUInt(max - 1); })); + RandomSource random; + std::shuffle(container.begin(), container.end(), URBG<size_t>([&]() { return static_cast<size_t>(random.randu64()); })); } } |