Random_numbers: Add overload for unifoem_smallint

This commit is contained in:
Andreas Fabri 2018-02-15 13:54:30 +00:00
parent a7a4966de8
commit ffcdb79bb6
1 changed files with 11 additions and 0 deletions

View File

@ -84,6 +84,7 @@ public:
}
template <typename IntType>
IntType
uniform_smallint(IntType lower, IntType upper)
@ -95,6 +96,16 @@ public:
return generator();
}
// Overload to avoid a warning with VC++
template <>
inline
std::size_t
uniform_smallint(std::size_t lower, std::size_t upper)
{
return uniform_smallint(static_cast<boost::rand48::result_type>(lower),
static_cast<boost::rand48::result_type>(upper));
}
template <typename IntType>
IntType
uniform_smallint(IntType lower)