Fix random::uniform() for integral types
This commit is contained in:
parent
d68242d59d
commit
d824159c2f
1 changed files with 5 additions and 1 deletions
|
|
@ -34,10 +34,14 @@ namespace psemek::random
|
|||
{
|
||||
return uniform<char>(rng, 0, 1) == 1;
|
||||
}
|
||||
else
|
||||
else if constexpr (std::is_floating_point_v<T>)
|
||||
{
|
||||
return uniform<T>(rng, T{0}, T{1});
|
||||
}
|
||||
else if constexpr (std::is_integral_v<T>)
|
||||
{
|
||||
return uniform<T>(rng, std::numeric_limits<T>::min(), std::numeric_limits<T>::max());
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T, std::size_t N, typename RNG>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue