mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2025-07-16 15:14:13 +00:00
add C++14 constexpr version: random generator
This commit is contained in:
parent
2c9f0647f4
commit
230630b45b
6 changed files with 44 additions and 2 deletions
|
@ -79,6 +79,11 @@ namespace sprout {
|
|||
SPROUT_CONSTEXPR result_type max() const SPROUT_NOEXCEPT {
|
||||
return static_max();
|
||||
}
|
||||
SPROUT_CXX14_CONSTEXPR result_type operator()() {
|
||||
typedef sprout::random::detail::const_mod<IntType, p> do_mod;
|
||||
x_ = do_mod::mult_add(a, do_mod::invert(x_), b);
|
||||
return x_;
|
||||
}
|
||||
SPROUT_CONSTEXPR sprout::random::random_result<inversive_congruential_engine> const operator()() const {
|
||||
typedef sprout::random::detail::const_mod<IntType, p> do_mod;
|
||||
return generate(do_mod::mult_add(a, do_mod::invert(x_), b));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue