diff --git a/extent.hpp b/extent.hpp index 867e93b0..d3587b03 100644 --- a/extent.hpp +++ b/extent.hpp @@ -166,13 +166,17 @@ namespace cruft { } + /// Return a uniform random point that lies within the extent. + /// + /// The interval conventions are the same as for the std library; close for + /// integers, half-open for reals. template cruft::point sample (cruft::extent shape, GeneratorT &&gen) { cruft::point p; for (size_t i = 0; i < S; ++i) - p[i] = cruft::random::uniform (0, shape[i], gen); + p[i] = cruft::random::uniform (T{0}, shape[i], gen); return p; }