From 803473fb647581319b22cc4461cde36bfb559617 Mon Sep 17 00:00:00 2001 From: joschiwald Date: Sun, 24 Apr 2016 01:15:56 +0200 Subject: Core/Utils: replaced std::random_shuffle with our own implementation using SFMT random generator (cherry picked from commit 9e371b766c75faf899cbbe24515b8b5c01716a50) --- src/common/Utilities/Containers.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/common/Utilities') diff --git a/src/common/Utilities/Containers.h b/src/common/Utilities/Containers.h index e8a40ede4c7..554dcb1b3de 100644 --- a/src/common/Utilities/Containers.h +++ b/src/common/Utilities/Containers.h @@ -117,6 +117,19 @@ namespace Trinity return SelectRandomWeightedContainerElement(container, weights); } + /** + * @fn void Trinity::Containers::RandomShuffle(C& container) + * + * @brief Reorder the elements of the container randomly. + * + * @param container Container to reorder + */ + template + 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) * -- cgit v1.2.3