aboutsummaryrefslogtreecommitdiff
path: root/src/common/Utilities/Containers.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/Utilities/Containers.h')
-rw-r--r--src/common/Utilities/Containers.h13
1 files changed, 13 insertions, 0 deletions
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
@@ -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