diff options
author | joschiwald <joschiwald.trinity@gmail.com> | 2016-04-24 01:15:56 +0200 |
---|---|---|
committer | joschiwald <joschiwald.trinity@gmail.com> | 2016-04-24 01:15:56 +0200 |
commit | 9e371b766c75faf899cbbe24515b8b5c01716a50 (patch) | |
tree | 5e3f8fc490f4db40b520bcffbefd45b04d8c0e2f /src/common/Utilities/Containers.h | |
parent | 6392887f2b903d052e778711c30431b738e5edd1 (diff) |
Core/Utils: replaced std::random_shuffle with our own implementation using SFMT random generator
Diffstat (limited to 'src/common/Utilities/Containers.h')
-rw-r--r-- | src/common/Utilities/Containers.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/common/Utilities/Containers.h b/src/common/Utilities/Containers.h index 7c889068011..0f83b52f9d0 100644 --- a/src/common/Utilities/Containers.h +++ b/src/common/Utilities/Containers.h @@ -118,6 +118,19 @@ namespace Trinity } /** + * @fn void Trinity::Containers::RandomShuffle(C& container) + * + * @brief Reorder the elements of the container randomly. + * + * @param container Container to reorder + */ + template <class C> + void RandomShuffle(C& container) + { + std::shuffle(container.begin(), container.end(), SFMTEngine::Instance()); + } + + /** * @fn bool Trinity::Containers::Intersects(Iterator first1, Iterator last1, Iterator first2, Iterator last2) * * @brief Checks if two SORTED containers have a common element |