12 template <
typename T,
typename U>
13 void shuffle(std::vector<T> &toShuffle, U &&rng) {
14 for(
size_t i = toShuffle.size() - 1; i >= 1; i--) {
15 const auto j = rng() % i;
16 std::swap(toShuffle[i], toShuffle[j]);
void shuffle(std::vector< T > &toShuffle, U &&rng)
Platform-independent alternative to std::shuffle implementing the Fisher-Yates shuffle algorithm.