[破壊的変更] uniform_int_distribution::max() 9 -> numeric_limits::max()

add reset function
This commit is contained in:
bolero-MURAKAMI 2013-11-09 18:13:26 +09:00
parent b60a7aca9c
commit 81603007f6
8 changed files with 19 additions and 8 deletions

View file

@ -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_);
}

View file

@ -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_);
}

View file

@ -121,6 +121,7 @@ namespace sprout {
SPROUT_CONSTEXPR result_type max() const SPROUT_NOEXCEPT {
return sprout::numeric_limits<result_type>::max();
}
SPROUT_CXX14_CONSTEXPR void reset() SPROUT_NOEXCEPT {}
SPROUT_CONSTEXPR param_type param() const SPROUT_NOEXCEPT {
return param_type(p_);
}

View file

@ -197,6 +197,9 @@ namespace sprout {
SPROUT_CONSTEXPR result_type max() const SPROUT_NOEXCEPT {
return sprout::numeric_limits<RealType>::infinity();
}
SPROUT_CXX14_CONSTEXPR void reset() SPROUT_NOEXCEPT {
valid_ = false;
}
SPROUT_CONSTEXPR param_type param() const SPROUT_NOEXCEPT {
return param_type(mean_, sigma_);
}

View file

@ -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();
}

View file

@ -801,9 +801,9 @@ namespace sprout {
public:
SPROUT_CONSTEXPR param_type()
: min_(0)
, max_(9)
, max_(sprout::numeric_limits<IntType>::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<IntType>::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<IntType>::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<IntType>::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_);
}

View file

@ -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_);
}

View file

@ -12,6 +12,7 @@
#include <istream>
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/limits.hpp>
#include <sprout/random/detail/signed_unsigned_tools.hpp>
#include <sprout/random/random_result.hpp>
#include <sprout/random/uniform_01.hpp>
@ -40,9 +41,9 @@ namespace sprout {
public:
SPROUT_CONSTEXPR param_type()
: min_(0)
, max_(9)
, max_(sprout::numeric_limits<IntType>::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<IntType>::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<IntType>::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<IntType>::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_);
}