mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2025-07-12 14:54:10 +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
|
@ -78,6 +78,10 @@ namespace sprout {
|
|||
SPROUT_CONSTEXPR result_type max() const SPROUT_NOEXCEPT {
|
||||
return static_max();
|
||||
}
|
||||
SPROUT_CXX14_CONSTEXPR result_type operator()() {
|
||||
x_ = ((x_ & ((wordmask() << (w - k)) & wordmask())) << s) ^ ((((x_ << q) ^ x_) & wordmask()) >> (k - s));
|
||||
return x_;
|
||||
}
|
||||
SPROUT_CONSTEXPR sprout::random::random_result<linear_feedback_shift_engine> const operator()() const {
|
||||
return generate(((x_ & ((wordmask() << (w - k)) & wordmask())) << s) ^ ((((x_ << q) ^ x_) & wordmask()) >> (k - s)));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue