random: add a generator parameter overload of uniform(ValueT)
This commit is contained in:
parent
e1f18edacf
commit
5d585d405f
13
random.hpp
13
random.hpp
@ -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 <
|
||||
|
Loading…
Reference in New Issue
Block a user