random: add a generator parameter overload of uniform(ValueT)

This commit is contained in:
Danny Robson 2020-11-06 12:27:29 +10:00
parent e1f18edacf
commit 5d585d405f

View File

@ -115,6 +115,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 <typename T, typename GeneratorT>
decltype(auto)
uniform (T hi, GeneratorT &&gen)
{
return uniform<T> (T{0}, hi, std::forward<GeneratorT> (gen));
}
///------------------------------------------------------------------------
/// Return a uniformly random value chosen on the interval [0,1)
template <