From 81603007f675b8eea5b8aff511a3bb75d3d527a9 Mon Sep 17 00:00:00 2001 From: bolero-MURAKAMI Date: Sat, 9 Nov 2013 18:13:26 +0900 Subject: [PATCH] =?UTF-8?q?[=E7=A0=B4=E5=A3=8A=E7=9A=84=E5=A4=89=E6=9B=B4]?= =?UTF-8?q?=20uniform=5Fint=5Fdistribution::max()=209=20->=20numeric=5Flim?= =?UTF-8?q?its::max()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit add reset function --- sprout/random/bernoulli_distribution.hpp | 1 + sprout/random/binomial_distribution.hpp | 1 + sprout/random/geometric_distribution.hpp | 1 + sprout/random/normal_distribution.hpp | 3 +++ sprout/random/uniform_01.hpp | 1 + sprout/random/uniform_int_distribution.hpp | 9 +++++---- sprout/random/uniform_real_distribution.hpp | 1 + sprout/random/uniform_smallint.hpp | 10 ++++++---- 8 files changed, 19 insertions(+), 8 deletions(-) diff --git a/sprout/random/bernoulli_distribution.hpp b/sprout/random/bernoulli_distribution.hpp index 90e337af..5117a45b 100644 --- a/sprout/random/bernoulli_distribution.hpp +++ b/sprout/random/bernoulli_distribution.hpp @@ -106,6 +106,7 @@ namespace sprout { SPROUT_CONSTEXPR result_type max() const SPROUT_NOEXCEPT { return true; } + SPROUT_CXX14_CONSTEXPR void reset() SPROUT_NOEXCEPT {} SPROUT_CONSTEXPR param_type param() const SPROUT_NOEXCEPT { return param_type(p_); } diff --git a/sprout/random/binomial_distribution.hpp b/sprout/random/binomial_distribution.hpp index 915d438e..180b8ea5 100644 --- a/sprout/random/binomial_distribution.hpp +++ b/sprout/random/binomial_distribution.hpp @@ -725,6 +725,7 @@ namespace sprout { SPROUT_CONSTEXPR result_type max() const SPROUT_NOEXCEPT { return t_; } + SPROUT_CXX14_CONSTEXPR void reset() SPROUT_NOEXCEPT {} SPROUT_CONSTEXPR param_type param() const SPROUT_NOEXCEPT { return param_type(t_, p_); } diff --git a/sprout/random/geometric_distribution.hpp b/sprout/random/geometric_distribution.hpp index 94b17a89..757ab3aa 100644 --- a/sprout/random/geometric_distribution.hpp +++ b/sprout/random/geometric_distribution.hpp @@ -121,6 +121,7 @@ namespace sprout { SPROUT_CONSTEXPR result_type max() const SPROUT_NOEXCEPT { return sprout::numeric_limits::max(); } + SPROUT_CXX14_CONSTEXPR void reset() SPROUT_NOEXCEPT {} SPROUT_CONSTEXPR param_type param() const SPROUT_NOEXCEPT { return param_type(p_); } diff --git a/sprout/random/normal_distribution.hpp b/sprout/random/normal_distribution.hpp index 96d8c2fe..8a8cb60c 100644 --- a/sprout/random/normal_distribution.hpp +++ b/sprout/random/normal_distribution.hpp @@ -197,6 +197,9 @@ namespace sprout { SPROUT_CONSTEXPR result_type max() const SPROUT_NOEXCEPT { return sprout::numeric_limits::infinity(); } + SPROUT_CXX14_CONSTEXPR void reset() SPROUT_NOEXCEPT { + valid_ = false; + } SPROUT_CONSTEXPR param_type param() const SPROUT_NOEXCEPT { return param_type(mean_, sigma_); } diff --git a/sprout/random/uniform_01.hpp b/sprout/random/uniform_01.hpp index 7b934a95..2ccb101f 100644 --- a/sprout/random/uniform_01.hpp +++ b/sprout/random/uniform_01.hpp @@ -129,6 +129,7 @@ namespace sprout { SPROUT_CONSTEXPR result_type max() const SPROUT_NOEXCEPT { return result_type(1); } + SPROUT_CXX14_CONSTEXPR void reset() SPROUT_NOEXCEPT {} SPROUT_CONSTEXPR param_type param() const SPROUT_NOEXCEPT { return param_type(); } diff --git a/sprout/random/uniform_int_distribution.hpp b/sprout/random/uniform_int_distribution.hpp index 5bfd863b..8eab22a2 100644 --- a/sprout/random/uniform_int_distribution.hpp +++ b/sprout/random/uniform_int_distribution.hpp @@ -801,9 +801,9 @@ namespace sprout { public: SPROUT_CONSTEXPR param_type() : min_(0) - , max_(9) + , max_(sprout::numeric_limits::max()) {} - explicit SPROUT_CONSTEXPR param_type(IntType min_arg, IntType max_arg = 9) + explicit SPROUT_CONSTEXPR param_type(IntType min_arg, IntType max_arg = sprout::numeric_limits::max()) : min_((SPROUT_ASSERT(min_arg <= max_arg), min_arg)) , max_(max_arg) {} @@ -861,9 +861,9 @@ namespace sprout { public: SPROUT_CONSTEXPR uniform_int_distribution() SPROUT_NOEXCEPT : min_(0) - , max_(9) + , max_(sprout::numeric_limits::max()) {} - explicit SPROUT_CONSTEXPR uniform_int_distribution(IntType min_arg, IntType max_arg = 9) + explicit SPROUT_CONSTEXPR uniform_int_distribution(IntType min_arg, IntType max_arg = sprout::numeric_limits::max()) : min_((SPROUT_ASSERT(min_arg <= max_arg), min_arg)) , max_(max_arg) {} @@ -883,6 +883,7 @@ namespace sprout { SPROUT_CONSTEXPR result_type max() const SPROUT_NOEXCEPT { return max_; } + SPROUT_CXX14_CONSTEXPR void reset() SPROUT_NOEXCEPT {} SPROUT_CONSTEXPR param_type param() const SPROUT_NOEXCEPT { return param_type(min_, max_); } diff --git a/sprout/random/uniform_real_distribution.hpp b/sprout/random/uniform_real_distribution.hpp index d22575f2..aef3e49d 100644 --- a/sprout/random/uniform_real_distribution.hpp +++ b/sprout/random/uniform_real_distribution.hpp @@ -490,6 +490,7 @@ namespace sprout { SPROUT_CONSTEXPR result_type max() const SPROUT_NOEXCEPT { return max_; } + SPROUT_CXX14_CONSTEXPR void reset() SPROUT_NOEXCEPT {} SPROUT_CONSTEXPR param_type param() const SPROUT_NOEXCEPT { return param_type(min_, max_); } diff --git a/sprout/random/uniform_smallint.hpp b/sprout/random/uniform_smallint.hpp index 4f801f85..adb187c5 100644 --- a/sprout/random/uniform_smallint.hpp +++ b/sprout/random/uniform_smallint.hpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -40,9 +41,9 @@ namespace sprout { public: SPROUT_CONSTEXPR param_type() : min_(0) - , max_(9) + , max_(sprout::numeric_limits::max()) {} - explicit SPROUT_CONSTEXPR param_type(IntType min_arg, IntType max_arg = 9) + explicit SPROUT_CONSTEXPR param_type(IntType min_arg, IntType max_arg = sprout::numeric_limits::max()) : min_((SPROUT_ASSERT(min_arg <= max_arg), min_arg)) , max_(max_arg) {} @@ -230,9 +231,9 @@ namespace sprout { public: SPROUT_CONSTEXPR uniform_smallint() SPROUT_NOEXCEPT : min_(0) - , max_(9) + , max_(sprout::numeric_limits::max()) {} - explicit SPROUT_CONSTEXPR uniform_smallint(IntType min_arg, IntType max_arg = 9) + explicit SPROUT_CONSTEXPR uniform_smallint(IntType min_arg, IntType max_arg = sprout::numeric_limits::max()) : min_((SPROUT_ASSERT(min_arg <= max_arg), min_arg)) , max_(max_arg) {} @@ -252,6 +253,7 @@ namespace sprout { SPROUT_CONSTEXPR result_type max() const SPROUT_NOEXCEPT { return max_; } + SPROUT_CXX14_CONSTEXPR void reset() SPROUT_NOEXCEPT {} SPROUT_CONSTEXPR param_type param() const SPROUT_NOEXCEPT { return param_type(min_, max_); }