#pragma once #include #include #include #include namespace rng { template inline void shuffle(R& rng, span span) { if(!span.size()) return; fmt::print(" -> shuffling {} objects...", span.size()); for(std::size_t i=span.size()-1;i>0;i--) { auto j = rng.next_long(i); std::swap(span[i], span[j]); } fmt::print(" OK\n"); } template inline void unshuffle(R& rng, span span) { if(!span.size()) return; std::vector rng_values(span.size()); fmt::print(" -> unshuffling {} objects...", span.size()); for(std::size_t i=span.size()-1;i>0;i--) rng_values.push_back(rng.next_long(i)); for(std::size_t i=1;i