Commit 0bd5bc85 authored by graham's avatar graham
Browse files

ENH: UList shuffle function to randomly reorder a list.

parent 9b1788ac
......@@ -145,6 +145,13 @@ void Foam::stableSort(UList<T>& a, const Cmp& cmp)
}
template<class T>
void Foam::shuffle(UList<T>& a)
{
std::random_shuffle(a.begin(), a.end());
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class T>
......
......@@ -344,6 +344,9 @@ void stableSort(UList<T>&);
template<class T, class Cmp>
void stableSort(UList<T>&, const Cmp&);
template<class T>
void shuffle(UList<T>&);
// Reverse the first n elements of the list
template<class T>
inline void reverse(UList<T>&, const label n);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment