diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-06-25 20:01:32 +1000 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-06-25 20:01:32 +1000 |
commit | 13a74602bd4c46149da9949d448387a40b8ebd1c (patch) | |
tree | 74c5d7c4f3732155e65e8df454017c5b7d2ca35d /source/core/StarRandom.hpp | |
parent | df661be1a3623d0a655758095fb08cb953448336 (diff) |
Upgrade to C++17
Diffstat (limited to 'source/core/StarRandom.hpp')
-rw-r--r-- | source/core/StarRandom.hpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/source/core/StarRandom.hpp b/source/core/StarRandom.hpp index b3c8ba2..c39f6ef 100644 --- a/source/core/StarRandom.hpp +++ b/source/core/StarRandom.hpp @@ -187,7 +187,8 @@ typename Container::value_type RandomSource::randValueFrom( template <typename Container> void RandomSource::shuffle(Container& container) { - std::random_shuffle(container.begin(), container.end(), [this](size_t max) { return randUInt(max - 1); }); + size_t max = container.size(); + std::shuffle(container.begin(), container.end(), URBG<size_t>([this, max]() { return randUInt(max - 1); })); } template <typename Container> @@ -208,7 +209,8 @@ typename Container::value_type Random::randValueFrom( template <typename Container> void Random::shuffle(Container& container) { - std::random_shuffle(container.begin(), container.end(), [](size_t max) { return Random::randUInt(max - 1); }); + size_t max = container.size(); + std::shuffle(container.begin(), container.end(), URBG<size_t>([max]() { return Random::randUInt(max - 1); })); } } |