diff --git a/random.hpp b/random.hpp index c5decdac..245df1ef 100644 --- a/random.hpp +++ b/random.hpp @@ -88,6 +88,19 @@ namespace cruft::random { } + ///------------------------------------------------------------------------ + /// Return a value uniformly chosen between 0 and the given value. + /// + /// Interval bounds are treated as per the standard Generator + /// implementations; ie, inclusive for integers, exclusive upper for reals. + template + decltype(auto) + uniform (T hi) + { + return uniform (T{0}, hi); + } + + ///------------------------------------------------------------------------ /// Return a uniformly random value chosen on the interval [0,1) template <