Add random::uniform(box)
This commit is contained in:
parent
74a513c76b
commit
a95182dc60
1 changed files with 10 additions and 0 deletions
|
|
@ -4,6 +4,7 @@
|
|||
#include <psemek/random/uniform_real.hpp>
|
||||
|
||||
#include <psemek/geom/constants.hpp>
|
||||
#include <psemek/geom/box.hpp>
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
|
|
@ -25,6 +26,15 @@ namespace psemek::random
|
|||
return uniform<T>(rng, {min, max});
|
||||
}
|
||||
|
||||
template <typename T, std::size_t N, typename RNG>
|
||||
geom::point<T, N> uniform(RNG && rng, geom::box<T, N> const & box)
|
||||
{
|
||||
geom::point<T, N> result;
|
||||
for (std::size_t i = 0; i < N; ++i)
|
||||
result[i] = uniform<T>(rng, box[i]);
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename T, typename RNG>
|
||||
T uniform_angle(RNG && rng)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue