Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/core/StarRandom.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/core/StarRandom.hpp')
-rw-r--r--source/core/StarRandom.hpp6
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); }));
}
}