random: add parameter free uniform for integral types
This commit is contained in:
parent
234adca06f
commit
ef24f0bfda
15
random.hpp
15
random.hpp
@ -189,6 +189,21 @@ namespace cruft::random {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///------------------------------------------------------------------------
|
||||||
|
/// Return a uniformly random chosen value over integral values in the type
|
||||||
|
template <typename T, typename GeneratorT>
|
||||||
|
requires (std::is_integral_v<T> and UniformRandomBitGenerator<std::remove_cvref_t<GeneratorT>>)
|
||||||
|
T
|
||||||
|
uniform (GeneratorT &&gen)
|
||||||
|
{
|
||||||
|
return uniform<T> (
|
||||||
|
std::numeric_limits<T>::min (),
|
||||||
|
std::numeric_limits<T>::max (),
|
||||||
|
std::forward<GeneratorT> (gen)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
///------------------------------------------------------------------------
|
///------------------------------------------------------------------------
|
||||||
/// Returns a uniformly random initialised coordinate type by value.
|
/// Returns a uniformly random initialised coordinate type by value.
|
||||||
template <
|
template <
|
||||||
|
Loading…
Reference in New Issue
Block a user