Commit 1a093c6c authored by Philip Trettner's avatar Philip Trettner

Merge branch 'develop' of...

Merge branch 'develop' of https://www.graphics.rwth-aachen.de:9000/ptrettner/typed-geometry into develop
parents 38d9198e 7a5c6703
......@@ -3,4 +3,5 @@
#include <typed-geometry/functions/random/gaussian.hh>
#include <typed-geometry/functions/random/random.hh>
#include <typed-geometry/functions/random/random_choice.hh>
#include <typed-geometry/functions/random/shuffle.hh>
#include <typed-geometry/functions/random/uniform.hh>
#pragma once
#include <typed-geometry/types/span.hh>
namespace tg
{
template <class Rng, class T>
constexpr void shuffle(Rng& rng, span<T> range)
{
for (size_t i = 1; i < range.size(); ++i)
{
auto j = rng() % (i + 1);
if (i != j)
detail::swap(range[i], range[j]);
}
}
template <class Rng, class Range>
constexpr void shuffle(Rng& rng, Range& range)
{
shuffle(rng, tg::span(range));
}
}
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