Add random::uniform_angle

This commit is contained in:
Nikita Lisitsa 2021-07-23 10:13:52 +03:00
parent 57fb1e8f1f
commit 824a15c921

View file

@ -3,6 +3,8 @@
#include <psemek/random/uniform_int.hpp>
#include <psemek/random/uniform_real.hpp>
#include <psemek/geom/constants.hpp>
#include <type_traits>
namespace psemek::random
@ -23,4 +25,10 @@ namespace psemek::random
return uniform<T>(rng, {min, max});
}
template <typename T, typename RNG>
T uniform_angle(RNG && rng)
{
return uniform(rng, T{0}, T{2 * geom::pi});
}
}