Core/Utils: replaced std::random_shuffle with our own implementation using SFMT random generator

(cherry picked from commit 9e371b766c)
This commit is contained in:
joschiwald
2016-04-24 01:15:56 +02:00
parent 2db839f676
commit 803473fb64
2 changed files with 15 additions and 2 deletions

View File

@@ -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 <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)
*