From ea8416592a3624926dc0858ae6216b34c9327290 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Thu, 11 Apr 2019 11:48:34 +1000 Subject: [PATCH] extent: use matching types for random calls --- extent.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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; }