diff --git a/sprout/random/shuffle_order.hpp b/sprout/random/shuffle_order.hpp index c2c89a92..24d899d8 100644 --- a/sprout/random/shuffle_order.hpp +++ b/sprout/random/shuffle_order.hpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -112,8 +113,8 @@ namespace sprout { return generate_1( rng_(), k == 1 ? BaseUnsigned(0) - : brange < std::numeric_limits::max() / k ? BaseUnsigned(k * off / (brange + 1)) - : brange < std::numeric_limits::max() / k + : sprout::math::less(brange, std::numeric_limits::max() / k) ? BaseUnsigned(k * off / (brange + 1)) + : sprout::math::less(brange, std::numeric_limits::max() / k) ? static_cast(static_cast(off) * k / (static_cast(brange) + 1)) //: static_cast(sprout::random::detail::muldiv(off, k, static_cast(brange) + 1)) // ??? : throw std::domain_error("shuffle_order_engine<>: Sorry, not implemented.")