diff options
author | Shauren <shauren.trinity@gmail.com> | 2022-01-03 12:48:40 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2022-01-03 12:48:40 +0100 |
commit | 08b5a0586aadd26b6ffa050e8538fd9ebb57591b (patch) | |
tree | 56dc2c02e17626d331af1ab6fd7b84f30c6e3b21 | |
parent | 3a67e376811743be208da4aab8a9e452e1ae637e (diff) |
Core/Util: Added iterator range overload for Trinity::Containers::RandomShuffle
-rw-r--r-- | src/common/Utilities/Containers.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/common/Utilities/Containers.h b/src/common/Utilities/Containers.h index c037ffd243b..ca0c9c49263 100644 --- a/src/common/Utilities/Containers.h +++ b/src/common/Utilities/Containers.h @@ -167,6 +167,20 @@ namespace Trinity } /** + * @fn void Trinity::Containers::RandomShuffle(Iterator begin, Iterator end) + * + * @brief Reorder the elements of the iterator range randomly. + * + * @param begin Beginning of the range to reorder + * @param end End of the range to reorder + */ + template<class Iterator> + inline void RandomShuffle(Iterator begin, Iterator end) + { + std::shuffle(begin, end, RandomEngine::Instance()); + } + + /** * @fn void Trinity::Containers::RandomShuffle(C& container) * * @brief Reorder the elements of the container randomly. @@ -176,7 +190,7 @@ namespace Trinity template<class C> inline void RandomShuffle(C& container) { - std::shuffle(std::begin(container), std::end(container), RandomEngine::Instance()); + RandomShuffle(std::begin(container), std::end(container)); } /** |