1
0
Fork 0
mirror of https://github.com/bolero-MURAKAMI/Sprout synced 2024-11-12 21:09:01 +00:00

fix warning: shuffle_order

This commit is contained in:
bolero-MURAKAMI 2012-12-21 23:21:50 +09:00
parent ddac080ec0
commit 88322b3d0a

View file

@ -11,6 +11,7 @@
#include <sprout/config.hpp>
#include <sprout/array.hpp>
#include <sprout/operation/fixed/set.hpp>
#include <sprout/math/compare.hpp>
#include <sprout/random/random_result.hpp>
#include <sprout/random/linear_congruential.hpp>
#include <sprout/random/detail/signed_unsigned_tools.hpp>
@ -112,8 +113,8 @@ namespace sprout {
return generate_1(
rng_(),
k == 1 ? BaseUnsigned(0)
: brange < std::numeric_limits<BaseUnsigned>::max() / k ? BaseUnsigned(k * off / (brange + 1))
: brange < std::numeric_limits<std::uintmax_t>::max() / k
: sprout::math::less(brange, std::numeric_limits<BaseUnsigned>::max() / k) ? BaseUnsigned(k * off / (brange + 1))
: sprout::math::less(brange, std::numeric_limits<std::uintmax_t>::max() / k)
? static_cast<BaseUnsigned>(static_cast<std::uintmax_t>(off) * k / (static_cast<std::uintmax_t>(brange) + 1))
//: static_cast<BaseUnsigned>(sprout::random::detail::muldiv(off, k, static_cast<std::uintmax_t>(brange) + 1)) // ???
: throw std::domain_error("shuffle_order_engine<>: Sorry, not implemented.")