random: add coord generator

This commit is contained in:
Danny Robson 2018-05-30 14:33:31 +10:00
parent d21b7809dd
commit 5dadd8eb38

View File

@ -123,6 +123,22 @@ namespace util::random {
}
//-------------------------------------------------------------------------
template <
typename T,
typename = std::enable_if_t<
is_coord_v<T> && std::is_floating_point_v<typename T::value_type>
>
>
T
uniform (void)
{
T res {};
std::fill (res.begin (), res.end (), uniform<typename T::value_type> ());
return res;
}
///////////////////////////////////////////////////////////////////////////
/// choose a value at random from an array
template <typename T, size_t N>