region: add 'sample' convenience without generator parameter

This commit is contained in:
Danny Robson 2019-08-22 13:22:48 +10:00
parent 70c523d029
commit 6367596537

View File

@ -287,6 +287,17 @@ namespace cruft {
} }
///------------------------------------------------------------------------
/// Returns a uniformly randomly sampled point within the supplied region
/// using the default thread-local generator.
template <size_t S, typename T>
decltype(auto)
sample (region<S,T> const &shape)
{
return sample (shape, cruft::random::generator ());
}
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
template <typename T> using region2 = region<2,T>; template <typename T> using region2 = region<2,T>;
template <typename T> using region3 = region<3,T>; template <typename T> using region3 = region<3,T>;