PR libstdc++/39629 (final bits)

2009-04-09  Paolo Carlini  <paolo.carlini@oracle.com>

	PR libstdc++/39629 (final bits)
	* include/bits/random.h (subtract_with_carry_engine<>::_S_modulus):
	Remove, consistently use __detail::_Shift<_UIntType, __w>::__value.
	* include/bits/random.tcc (shuffle_order_engine<>::operator()()):
	Fix formula for __j.
	* include/bits/random.tcc (operator==(const normal_distribution<>&,
	const normal_distribution<>&): Remove.
	* include/bits/random.h (operator==(const uniform_int_distribution<>&,
	const uniform_int_distribution<>&), operator==(const
	uniform_real_distribution<>&, const uniform_real_distribution<>&),
	operator==(const normal_distribution<>&, const normal_distribution<>&), 
	operator==(const lognormal_distribution<>&,
	const lognormal_distribution<>&), operator==(const
	chi_squared_distribution<>&, const chi_squared_distribution<>&),
	operator==(const cauchy_distribution<>&, const cauchy_distribution<>&),
	operator==(const fisher_distribution<>&, const fisher_distribution<>&),
	operator==(const student_t_distribution<>&,
	const student_t_distribution<>&), operator==(const
	bernoulli_distribution<>&, const bernoulli_distribution<>&),
	operator==(const binomial_distribution<>&, const
	binomial_distribution<>&), operator==(const geometric_distribution<>&,
	const geometric_distribution<>&), operator==(const
	negative_binomial_distribution<>&, const 
	negative_binomial_distribution<>&), operator==(const
	poisson_distribution<>&, const poisson_distribution<>&),
	operator==(const exponential_distribution<>&,
	const exponential_distribution<>&), operator==(const
	gamma_distribution<>&, const gamma_distribution<>&), operator==(const
	weibull_distribution<>&, const weibull_distribution<>&),
	operator==(const extreme_value_distribution<>&,
	const extreme_value_distribution<>&), operator==(const
	discrete_distribution<>&, const discrete_distribution<>&),
	operator==(const piecewise_constant_distribution<>&,
	const piecewise_constant_distribution<>&), operator==(const
	piecewise_linear_distribution<>&, const
	piecewise_linear_distribution<>&)): Remove.
	* testsuite/26_numerics/random/uniform_real_distribution/operators/
	serialize.cc: Remove.
	* testsuite/26_numerics/random/piecewise_constant_distribution/
	operators/serialize.cc: Likewise.
	* testsuite/26_numerics/random/chi_squared_distribution/operators/
	serialize.cc: Likewise.
	* testsuite/26_numerics/random/normal_distribution/operators/
	serialize.cc: Likewise.
	* testsuite/26_numerics/random/uniform_int_distribution/operators/
	serialize.cc: Likewise.
	* testsuite/26_numerics/random/poisson_distribution/operators/
	serialize.cc: Likewise.
	* testsuite/26_numerics/random/bernoulli_distribution/operators/
	serialize.cc: Likewise.
	* testsuite/26_numerics/random/discrete_distribution/operators/
	serialize.cc: Likewise.
	* testsuite/26_numerics/random/weibull_distribution/operators/
	serialize.cc: Likewise.
	* testsuite/26_numerics/random/negative_binomial_distribution/
	operators/serialize.cc: Likewise.
	* testsuite/26_numerics/random/cauchy_distribution/operators/
	serialize.cc: Likewise.
	* testsuite/26_numerics/random/gamma_distribution/operators/
	serialize.cc: Likewise.
	* testsuite/26_numerics/random/fisher_f_distribution/operators/
	serialize.cc: Likewise.
	* testsuite/26_numerics/random/exponential_distribution/operators/
	serialize.cc: Likewise.
	* testsuite/26_numerics/random/lognormal_distribution/operators/
	serialize.cc: Likewise.
	* testsuite/26_numerics/random/binomial_distribution/operators/
	serialize.cc: Likewise.
	* testsuite/26_numerics/random/extreme_value_distribution/
	operators/serialize.cc: Likewise.
	* testsuite/26_numerics/random/piecewise_linear_distribution/
	operators/serialize.cc: Likewise.
	* testsuite/26_numerics/random/student_t_distribution/operators/
	serialize.cc: Likewise.
	* testsuite/26_numerics/random/geometric_distribution/operators/
	serialize.cc: Likewise.

	* include/bits/random.h (linear_congruential_engine<>::seed(_Gen&,
	true_type), linear_congruential_engine<>::seed(_Gen&, false_type),
	mersenne_twister_engine<>::seed(_Gen&,
	true_type), mersenne_twister_engine<>::seed(_Gen&, false_type),
	subtract_with_carry_engine<>::seed(_Gen&,
	true_type), subtract_with_carry_engine<>::seed(_Gen&, false_type)):
	Remove, unused.
	* include/bits/random.tcc (linear_congruential_engine<>::
	seed(_Gen&, false_type): Likewise.

From-SVN: r145867
This commit is contained in:
Paolo Carlini 2009-04-09 23:37:08 +00:00 committed by Paolo Carlini
parent 805586285d
commit 96a9203b1c
23 changed files with 115 additions and 1408 deletions

View File

@ -1,3 +1,92 @@
2009-04-09 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/39629 (final bits)
* include/bits/random.h (subtract_with_carry_engine<>::_S_modulus):
Remove, consistently use __detail::_Shift<_UIntType, __w>::__value.
* include/bits/random.tcc (shuffle_order_engine<>::operator()()):
Fix formula for __j.
* include/bits/random.tcc (operator==(const normal_distribution<>&,
const normal_distribution<>&): Remove.
* include/bits/random.h (operator==(const uniform_int_distribution<>&,
const uniform_int_distribution<>&), operator==(const
uniform_real_distribution<>&, const uniform_real_distribution<>&),
operator==(const normal_distribution<>&, const normal_distribution<>&),
operator==(const lognormal_distribution<>&,
const lognormal_distribution<>&), operator==(const
chi_squared_distribution<>&, const chi_squared_distribution<>&),
operator==(const cauchy_distribution<>&, const cauchy_distribution<>&),
operator==(const fisher_distribution<>&, const fisher_distribution<>&),
operator==(const student_t_distribution<>&,
const student_t_distribution<>&), operator==(const
bernoulli_distribution<>&, const bernoulli_distribution<>&),
operator==(const binomial_distribution<>&, const
binomial_distribution<>&), operator==(const geometric_distribution<>&,
const geometric_distribution<>&), operator==(const
negative_binomial_distribution<>&, const
negative_binomial_distribution<>&), operator==(const
poisson_distribution<>&, const poisson_distribution<>&),
operator==(const exponential_distribution<>&,
const exponential_distribution<>&), operator==(const
gamma_distribution<>&, const gamma_distribution<>&), operator==(const
weibull_distribution<>&, const weibull_distribution<>&),
operator==(const extreme_value_distribution<>&,
const extreme_value_distribution<>&), operator==(const
discrete_distribution<>&, const discrete_distribution<>&),
operator==(const piecewise_constant_distribution<>&,
const piecewise_constant_distribution<>&), operator==(const
piecewise_linear_distribution<>&, const
piecewise_linear_distribution<>&)): Remove.
* testsuite/26_numerics/random/uniform_real_distribution/operators/
serialize.cc: Remove.
* testsuite/26_numerics/random/piecewise_constant_distribution/
operators/serialize.cc: Likewise.
* testsuite/26_numerics/random/chi_squared_distribution/operators/
serialize.cc: Likewise.
* testsuite/26_numerics/random/normal_distribution/operators/
serialize.cc: Likewise.
* testsuite/26_numerics/random/uniform_int_distribution/operators/
serialize.cc: Likewise.
* testsuite/26_numerics/random/poisson_distribution/operators/
serialize.cc: Likewise.
* testsuite/26_numerics/random/bernoulli_distribution/operators/
serialize.cc: Likewise.
* testsuite/26_numerics/random/discrete_distribution/operators/
serialize.cc: Likewise.
* testsuite/26_numerics/random/weibull_distribution/operators/
serialize.cc: Likewise.
* testsuite/26_numerics/random/negative_binomial_distribution/
operators/serialize.cc: Likewise.
* testsuite/26_numerics/random/cauchy_distribution/operators/
serialize.cc: Likewise.
* testsuite/26_numerics/random/gamma_distribution/operators/
serialize.cc: Likewise.
* testsuite/26_numerics/random/fisher_f_distribution/operators/
serialize.cc: Likewise.
* testsuite/26_numerics/random/exponential_distribution/operators/
serialize.cc: Likewise.
* testsuite/26_numerics/random/lognormal_distribution/operators/
serialize.cc: Likewise.
* testsuite/26_numerics/random/binomial_distribution/operators/
serialize.cc: Likewise.
* testsuite/26_numerics/random/extreme_value_distribution/
operators/serialize.cc: Likewise.
* testsuite/26_numerics/random/piecewise_linear_distribution/
operators/serialize.cc: Likewise.
* testsuite/26_numerics/random/student_t_distribution/operators/
serialize.cc: Likewise.
* testsuite/26_numerics/random/geometric_distribution/operators/
serialize.cc: Likewise.
* include/bits/random.h (linear_congruential_engine<>::seed(_Gen&,
true_type), linear_congruential_engine<>::seed(_Gen&, false_type),
mersenne_twister_engine<>::seed(_Gen&,
true_type), mersenne_twister_engine<>::seed(_Gen&, false_type),
subtract_with_carry_engine<>::seed(_Gen&,
true_type), subtract_with_carry_engine<>::seed(_Gen&, false_type)):
Remove, unused.
* include/bits/random.tcc (linear_congruential_engine<>::
seed(_Gen&, false_type): Likewise.
2009-04-09 Nick Clifton <nickc@redhat.com>
* src/allocator-inst.cc: Change copyright header to refer to

View File

@ -70,8 +70,8 @@ namespace std
// XXX need constexpr
template<typename _UIntType, size_t __w,
bool = __w <static_cast<size_t>
(std::numeric_limits<_UIntType>::digits)>
bool = __w < static_cast<size_t>
(std::numeric_limits<_UIntType>::digits)>
struct _ShiftMin1
{
static const _UIntType __value =
@ -206,7 +206,7 @@ namespace std
static const result_type increment = __c;
/** The modulus. */
static const result_type modulus = __m;
static const result_type default_seed = 1UL;
static const result_type default_seed = 1u;
/**
* @brief Constructs a %linear_congruential_engine random number
@ -258,7 +258,7 @@ namespace std
*/
result_type
min() const
{ return (__detail::__mod<_UIntType, 1, 0, __m>(__c) == 0) ? 1 : 0; }
{ return __c == 0u ? 1u : 0u; }
/**
* @brief Gets the largest possible value in the output range.
@ -267,7 +267,7 @@ namespace std
*/
result_type
max() const
{ return __m - 1; }
{ return __m - 1u; }
/**
* @brief Discard a sequence of random numbers.
@ -340,15 +340,6 @@ namespace std
__c1, __m1>&);
private:
template<typename _Gen>
void
seed(_Gen& __g, true_type)
{ return seed(static_cast<unsigned long>(__g)); }
template<typename _Gen>
void
seed(_Gen& __g, false_type);
_UIntType _M_x;
};
@ -429,7 +420,7 @@ namespace std
static const result_type tempering_c = __c;
static const size_t tempering_l = __l;
static const size_t initialization_multiplier = __f;
static const result_type default_seed = 5489UL;
static const result_type default_seed = 5489u;
// constructors and member function
explicit
@ -554,15 +545,6 @@ namespace std
__l1, __f1>&);
private:
template<typename _Gen>
void
seed(_Gen& __g, true_type)
{ return seed(static_cast<unsigned long>(__g)); }
template<typename _Gen>
void
seed(_Gen& __g, false_type);
_UIntType _M_x[state_size];
size_t _M_p;
};
@ -602,7 +584,7 @@ namespace std
static const size_t word_size = __w;
static const size_t short_lag = __s;
static const size_t long_lag = __r;
static const result_type default_seed = 19780503;
static const result_type default_seed = 19780503u;
/**
* @brief Constructs an explicitly seeded % subtract_with_carry_engine
@ -662,7 +644,7 @@ namespace std
*/
result_type
max() const
{ return _S_modulus - 1U; }
{ return __detail::_ShiftMin1<_UIntType, __w>::__value; }
/**
* @brief Discard a sequence of random numbers.
@ -736,18 +718,6 @@ namespace std
__s1, __r1>&);
private:
template<typename _Gen>
void
seed(_Gen& __g, true_type)
{ return seed(static_cast<unsigned long>(__g)); }
template<typename _Gen>
void
seed(_Gen& __g, false_type);
static const size_t _S_modulus
= __detail::_Shift<_UIntType, __w>::__value;
_UIntType _M_x[long_lag];
_UIntType _M_carry;
size_t _M_p;
@ -1564,10 +1534,6 @@ namespace std
b() const
{ return _M_b; }
friend bool
operator==(const param_type& __p1, const param_type& __p2)
{ return (__p1._M_a == __p2._M_a) && (__p1._M_b == __p2._M_b); }
private:
_IntType _M_a;
_IntType _M_b;
@ -1681,16 +1647,6 @@ namespace std
param_type _M_param;
};
/**
* @brief Return true if two uniform integer distributions have
* the same parameters.
*/
template<typename _IntType>
inline bool
operator==(const std::uniform_int_distribution<_IntType>& __d1,
const std::uniform_int_distribution<_IntType>& __d2)
{ return __d1.param() == __d2.param(); }
/**
* @brief Inserts a %uniform_int_distribution random number
* distribution @p __x into the output stream @p os.
@ -1755,10 +1711,6 @@ namespace std
b() const
{ return _M_b; }
friend bool
operator==(const param_type& __p1, const param_type& __p2)
{ return (__p1._M_a == __p2._M_a) && (__p1._M_b == __p2._M_b); }
private:
_RealType _M_a;
_RealType _M_b;
@ -1850,16 +1802,6 @@ namespace std
param_type _M_param;
};
/**
* @brief Return true if two uniform real distributions have
* the same parameters.
*/
template<typename _IntType>
inline bool
operator==(const std::uniform_real_distribution<_IntType>& __d1,
const std::uniform_real_distribution<_IntType>& __d2)
{ return __d1.param() == __d2.param(); }
/**
* @brief Inserts a %uniform_real_distribution random number
* distribution @p __x into the output stream @p __os.
@ -1931,11 +1873,6 @@ namespace std
stddev() const
{ return _M_stddev; }
friend bool
operator==(const param_type& __p1, const param_type& __p2)
{ return (__p1._M_mean == __p2._M_mean)
&& (__p1._M_stddev == __p2._M_stddev); }
private:
_RealType _M_mean;
_RealType _M_stddev;
@ -2017,15 +1954,6 @@ namespace std
operator()(_UniformRandomNumberGenerator& __urng,
const param_type& __p);
/**
* @brief Return true if two normal distributions have
* the same parameters.
*/
template<typename _RealType1>
friend bool
operator==(const std::normal_distribution<_RealType1>& __d1,
const std::normal_distribution<_RealType1>& __d2);
/**
* @brief Inserts a %normal_distribution random number distribution
* @p __x into the output stream @p __os.
@ -2095,10 +2023,6 @@ namespace std
s() const
{ return _M_s; }
friend bool
operator==(const param_type& __p1, const param_type& __p2)
{ return (__p1._M_m == __p2._M_m) && (__p1._M_s == __p2._M_s); }
private:
_RealType _M_m;
_RealType _M_s;
@ -2176,16 +2100,6 @@ namespace std
param_type _M_param;
};
/**
* @brief Return true if two lognormal distributions have
* the same parameters.
*/
template<typename _RealType>
inline bool
operator==(const std::lognormal_distribution<_RealType>& __d1,
const std::lognormal_distribution<_RealType>& __d2)
{ return __d1.param() == __d2.param(); }
/**
* @brief Inserts a %lognormal_distribution random number distribution
* @p __x into the output stream @p __os.
@ -2243,10 +2157,6 @@ namespace std
n() const
{ return _M_n; }
friend bool
operator==(const param_type& __p1, const param_type& __p2)
{ return __p1._M_n == __p2._M_n; }
private:
_RealType _M_n;
};
@ -2318,16 +2228,6 @@ namespace std
param_type _M_param;
};
/**
* @brief Return true if two Chi-squared distributions have
* the same parameters.
*/
template<typename _RealType>
inline bool
operator==(const std::chi_squared_distribution<_RealType>& __d1,
const std::chi_squared_distribution<_RealType>& __d2)
{ return __d1.param() == __d2.param(); }
/**
* @brief Inserts a %chi_squared_distribution random number distribution
* @p __x into the output stream @p __os.
@ -2390,10 +2290,6 @@ namespace std
b() const
{ return _M_b; }
friend bool
operator==(const param_type& __p1, const param_type& __p2)
{ return (__p1._M_a == __p2._M_a) && (__p1._M_b == __p2._M_b); }
private:
_RealType _M_a;
_RealType _M_b;
@ -2471,16 +2367,6 @@ namespace std
param_type _M_param;
};
/**
* @brief Return true if two Cauchy distributions have
* the same parameters.
*/
template<typename _RealType>
inline bool
operator==(const std::cauchy_distribution<_RealType>& __d1,
const std::cauchy_distribution<_RealType>& __d2)
{ return __d1.param() == __d2.param(); }
/**
* @brief Inserts a %cauchy_distribution random number distribution
* @p __x into the output stream @p __os.
@ -2545,10 +2431,6 @@ namespace std
n() const
{ return _M_n; }
friend bool
operator==(const param_type& __p1, const param_type& __p2)
{ return (__p1._M_m == __p2._M_m) && (__p1._M_n == __p2._M_n); }
private:
_RealType _M_m;
_RealType _M_n;
@ -2626,16 +2508,6 @@ namespace std
param_type _M_param;
};
/**
* @brief Return true if two Fisher f distributions have
* the same parameters.
*/
template<typename _RealType>
inline bool
operator==(const std::fisher_f_distribution<_RealType>& __d1,
const std::fisher_f_distribution<_RealType>& __d2)
{ return __d1.param() == __d2.param(); }
/**
* @brief Inserts a %fisher_f_distribution random number distribution
* @p __x into the output stream @p __os.
@ -2694,10 +2566,6 @@ namespace std
n() const
{ return _M_n; }
friend bool
operator==(const param_type& __p1, const param_type& __p2)
{ return __p1._M_n == __p2._M_n; }
private:
_RealType _M_n;
};
@ -2774,16 +2642,6 @@ namespace std
param_type _M_param;
};
/**
* @brief Return true if two Student t distributions have
* the same parameters.
*/
template<typename _RealType>
inline bool
operator==(const std::student_t_distribution<_RealType>& __d1,
const std::student_t_distribution<_RealType>& __d2)
{ return __d1.param() == __d2.param(); }
/**
* @brief Inserts a %student_t_distribution random number distribution
* @p __x into the output stream @p __os.
@ -2849,10 +2707,6 @@ namespace std
p() const
{ return _M_p; }
friend bool
operator==(const param_type& __p1, const param_type& __p2)
{ return __p1._M_p == __p2._M_p; }
private:
double _M_p;
};
@ -2950,15 +2804,6 @@ namespace std
param_type _M_param;
};
/**
* @brief Return true if two Bernoulli distributions have
* the same parameters.
*/
inline bool
operator==(const std::bernoulli_distribution& __d1,
const std::bernoulli_distribution& __d2)
{ return __d1.param() == __d2.param(); }
/**
* @brief Inserts a %bernoulli_distribution random number distribution
* @p __x into the output stream @p __os.
@ -3034,10 +2879,6 @@ namespace std
p() const
{ return _M_p; }
friend bool
operator==(const param_type& __p1, const param_type& __p2)
{ return (__p1._M_t == __p2._M_t) && (__p1._M_p == __p2._M_p); }
private:
void
_M_initialize();
@ -3115,17 +2956,6 @@ namespace std
max() const
{ return _M_param.t(); }
/**
* @brief Return true if two binomial distributions have
* the same parameters.
*/
template<typename _IntType1>
friend bool
operator==(const std::binomial_distribution<_IntType1>& __d1,
const std::binomial_distribution<_IntType1>& __d2)
{ return ((__d1.param() == __d2.param())
&& (__d1._M_nd == __d2._M_nd)); }
template<typename _UniformRandomNumberGenerator>
result_type
operator()(_UniformRandomNumberGenerator& __urng)
@ -3214,10 +3044,6 @@ namespace std
p() const
{ return _M_p; }
friend bool
operator==(const param_type& __p1, const param_type& __p2)
{ return __p1._M_p == __p2._M_p; }
private:
void
_M_initialize()
@ -3297,16 +3123,6 @@ namespace std
param_type _M_param;
};
/**
* @brief Return true if two geometric distributions have
* the same parameters.
*/
template<typename _IntType>
inline bool
operator==(const geometric_distribution<_IntType>& __d1,
const geometric_distribution<_IntType>& __d2)
{ return __d1.param() == __d2.param(); }
/**
* @brief Inserts a %geometric_distribution random number distribution
* @p __x into the output stream @p __os.
@ -3372,10 +3188,6 @@ namespace std
p() const
{ return _M_p; }
friend bool
operator==(const param_type& __p1, const param_type& __p2)
{ return (__p1._M_k == __p2._M_k) && (__p1._M_p == __p2._M_p); }
private:
_IntType _M_k;
double _M_p;
@ -3455,16 +3267,6 @@ namespace std
param_type _M_param;
};
/**
* @brief Return true if two negative binomial distributions have
* the same parameters.
*/
template<typename _IntType>
inline bool
operator==(const std::negative_binomial_distribution<_IntType>& __d1,
const std::negative_binomial_distribution<_IntType>& __d2)
{ return __d1.param() == __d2.param(); }
/**
* @brief Inserts a %negative_binomial_distribution random
* number distribution @p __x into the output stream @p __os.
@ -3537,10 +3339,6 @@ namespace std
mean() const
{ return _M_mean; }
friend bool
operator==(const param_type& __p1, const param_type& __p2)
{ return __p1._M_mean == __p2._M_mean; }
private:
// Hosts either log(mean) or the threshold of the simple method.
void
@ -3618,17 +3416,6 @@ namespace std
operator()(_UniformRandomNumberGenerator& __urng,
const param_type& __p);
/**
* @brief Return true if two Poisson distributions have the same
* parameters.
*/
template<typename _IntType1>
friend bool
operator==(const std::poisson_distribution<_IntType1>& __d1,
const std::poisson_distribution<_IntType1>& __d2)
{ return ((__d1.param() == __d2.param())
&& (__d1._M_nd == __d2._M_nd)); }
/**
* @brief Inserts a %poisson_distribution random number distribution
* @p __x into the output stream @p __os.
@ -3703,10 +3490,6 @@ namespace std
lambda() const
{ return _M_lambda; }
friend bool
operator==(const param_type& __p1, const param_type& __p2)
{ return __p1._M_lambda == __p2._M_lambda; }
private:
_RealType _M_lambda;
};
@ -3793,16 +3576,6 @@ namespace std
param_type _M_param;
};
/**
* @brief Return true if two exponential distributions have the same
* parameters.
*/
template<typename _RealType>
inline bool
operator==(const std::exponential_distribution<_RealType>& __d1,
const std::exponential_distribution<_RealType>& __d2)
{ return __d1.param() == __d2.param(); }
/**
* @brief Inserts a %exponential_distribution random number distribution
* @p __x into the output stream @p __os.
@ -3870,11 +3643,6 @@ namespace std
beta() const
{ return _M_beta; }
friend bool
operator==(const param_type& __p1, const param_type& __p2)
{ return ((__p1._M_alpha == __p2._M_alpha)
&& (__p1._M_beta == __p2._M_beta)); }
private:
void
_M_initialize();
@ -3967,16 +3735,6 @@ namespace std
param_type _M_param;
};
/**
* @brief Return true if two gamma distributions have the same
* parameters.
*/
template<typename _RealType>
inline bool
operator==(const std::gamma_distribution<_RealType>& __d1,
const std::gamma_distribution<_RealType>& __d2)
{ return __d1.param() == __d2.param(); }
/**
* @brief Inserts a %gamma_distribution random number distribution
* @p __x into the output stream @p __os.
@ -4039,10 +3797,6 @@ namespace std
b() const
{ return _M_b; }
friend bool
operator==(const param_type& __p1, const param_type& __p2)
{ return (__p1._M_a == __p2._M_a) && (__p1._M_b == __p2._M_b); }
private:
_RealType _M_a;
_RealType _M_b;
@ -4129,16 +3883,6 @@ namespace std
param_type _M_param;
};
/**
* @brief Return true if two Weibull distributions have the same
* parameters.
*/
template<typename _RealType>
inline bool
operator==(const std::weibull_distribution<_RealType>& __d1,
const std::weibull_distribution<_RealType>& __d2)
{ return __d1.param() == __d2.param(); }
/**
* @brief Inserts a %weibull_distribution random number distribution
* @p __x into the output stream @p __os.
@ -4202,10 +3946,6 @@ namespace std
b() const
{ return _M_b; }
friend bool
operator==(const param_type& __p1, const param_type& __p2)
{ return (__p1._M_a == __p2._M_a) && (__p1._M_b == __p2._M_b); }
private:
_RealType _M_a;
_RealType _M_b;
@ -4286,15 +4026,6 @@ namespace std
param_type _M_param;
};
/**
*
*/
template<typename _RealType>
inline bool
operator==(const std::extreme_value_distribution<_RealType>& __d1,
const std::extreme_value_distribution<_RealType>& __d2)
{ return __d1.param() == __d2.param(); }
/**
* @brief Inserts a %extreme_value_distribution random number distribution
* @p __x into the output stream @p __os.
@ -4368,10 +4099,6 @@ namespace std
probabilities() const
{ return _M_prob; }
friend bool
operator==(const param_type& __p1, const param_type& __p2)
{ return __p1._M_prob == __p2._M_prob; }
private:
void
_M_initialize();
@ -4493,15 +4220,6 @@ namespace std
param_type _M_param;
};
/**
*
*/
template<typename _IntType>
inline bool
operator==(const std::discrete_distribution<_IntType>& __d1,
const std::discrete_distribution<_IntType>& __d2)
{ return __d1.param() == __d2.param(); }
/**
* @brief A piecewise_constant_distribution random number distribution.
@ -4543,11 +4261,6 @@ namespace std
densities() const
{ return _M_den; }
friend bool
operator==(const param_type& __p1, const param_type& __p2)
{ return ((__p1._M_int == __p2._M_int)
&& (__p1._M_den == __p2._M_den)); }
private:
void
_M_initialize();
@ -4683,15 +4396,6 @@ namespace std
param_type _M_param;
};
/**
*
*/
template<typename _RealType>
inline bool
operator==(const std::piecewise_constant_distribution<_RealType>& __d1,
const std::piecewise_constant_distribution<_RealType>& __d2)
{ return __d1.param() == __d2.param(); }
/**
* @brief A piecewise_linear_distribution random number distribution.
@ -4733,11 +4437,6 @@ namespace std
densities() const
{ return _M_den; }
friend bool
operator==(const param_type& __p1, const param_type& __p2)
{ return ((__p1._M_int == __p2._M_int)
&& (__p1._M_den == __p2._M_den)); }
private:
void
_M_initialize();
@ -4875,14 +4574,6 @@ namespace std
param_type _M_param;
};
/**
*
*/
template<typename _RealType>
inline bool
operator==(const std::piecewise_linear_distribution<_RealType>& __d1,
const std::piecewise_linear_distribution<_RealType>& __d2)
{ return __d1.param() == __d2.param(); }
/* @} */ // group std_random_distributions_poisson

View File

@ -90,23 +90,23 @@ namespace std
} // namespace __detail
/**
* Seeds the LCR with integral value @p __x0, adjusted so that the
* Seeds the LCR with integral value @p __s, adjusted so that the
* ring identity is never a member of the convergence set.
*/
template<typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
void
linear_congruential_engine<_UIntType, __a, __c, __m>::
seed(_UIntType __x0)
seed(result_type __s)
{
if ((__detail::__mod<_UIntType, 1U, 0U, __m>(__c) == 0U)
&& (__detail::__mod<_UIntType, 1U, 0U, __m>(__x0) == 0U))
&& (__detail::__mod<_UIntType, 1U, 0U, __m>(__s) == 0U))
_M_x = __detail::__mod<_UIntType, 1U, 0U, __m>(1U);
else
_M_x = __detail::__mod<_UIntType, 1U, 0U, __m>(__x0);
_M_x = __detail::__mod<_UIntType, 1U, 0U, __m>(__s);
}
/**
* Seeds the LCR engine with a value generated by @p __g.
* Seeds the LCR engine with a value generated by @p __q.
*/
template<typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
void
@ -117,39 +117,17 @@ namespace std
: std::__lg(__m);
const _UIntType __k = (__k0 + 31) / 32;
_UIntType __arr[__k + 3];
__q.generate(__arr + 0, __arr + 3);
__q.generate(__arr + 0, __arr + __k + 3);
_UIntType __factor = 1U;
_UIntType __sum = 0U;
for (size_t __i = 0; __i < __k; ++__i)
for (size_t __j = 0; __j < __k; ++__j)
{
__sum += __arr[__i + 3] * __factor;
__sum += __arr[__j + 3] * __factor;
__factor *= __detail::_Shift<_UIntType, 32>::__value;
}
if ((__detail::__mod<_UIntType, 1U, 0U, __m>(__c) == 0U)
&& (__detail::__mod<_UIntType, 1U, 0U, __m>(__sum) == 0U))
_M_x = __detail::__mod<_UIntType, 1U, 0U, __m>(1U);
else
_M_x = __detail::__mod<_UIntType, 1U, 0U, __m>(__sum);
seed(__sum);
}
/**
* Seeds the LCR engine with a value generated by @p __g.
*/
template<typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
template<typename _Gen>
void
linear_congruential_engine<_UIntType, __a, __c, __m>::
seed(_Gen& __g, false_type)
{
_UIntType __x0 = __g();
if ((__detail::__mod<_UIntType, 1U, 0U, __m>(__c) == 0U)
&& (__detail::__mod<_UIntType, 1U, 0U, __m>(__x0) == 0U))
_M_x = __detail::__mod<_UIntType, 1U, 0U, __m>(1U);
else
_M_x = __detail::__mod<_UIntType, 1U, 0U, __m>(__x0);
}
/**
* Gets the next generated value in sequence.
*/
@ -399,7 +377,8 @@ namespace std
(__lcg()) * __factor;
__factor *= __detail::_Shift<_UIntType, 32>::__value;
}
_M_x[__i] = __detail::__mod<_UIntType, 1, 0, _S_modulus>(__sum);
_M_x[__i] = __detail::__mod<_UIntType, 1, 0,
__detail::_Shift<_UIntType, __w>::__value>(__sum);
}
_M_carry = (_M_x[long_lag - 1] == 0) ? 1 : 0;
_M_p = 0;
@ -411,7 +390,7 @@ namespace std
seed(seed_seq& __q)
{
const size_t __n = (word_size + 31) / 32;
unsigned int __arr[long_lag + __n];
_UIntType __arr[long_lag + __n];
__q.generate(__arr + 0, __arr + long_lag + __n);
for (size_t __i = 0; __i < long_lag; ++__i)
@ -424,7 +403,8 @@ namespace std
(__arr[__i * __n + __j]) * __factor;
__factor *= __detail::_Shift<_UIntType, 32>::__value;
}
_M_x[__i] = __detail::__mod<_UIntType, 1, 0, _S_modulus>(__sum);
_M_x[__i] = __detail::__mod<_UIntType, 1, 0,
__detail::_Shift<_UIntType, __w>::__value>(__sum);
}
_M_carry = (_M_x[long_lag - 1] == 0) ? 1 : 0;
_M_p = 0;
@ -452,7 +432,8 @@ namespace std
}
else
{
__xi = _S_modulus - _M_x[_M_p] - _M_carry + _M_x[__ps];
__xi = (__detail::_Shift<_UIntType, __w>::__value
- _M_x[_M_p] - _M_carry + _M_x[__ps]);
_M_carry = 1;
}
_M_x[_M_p] = __xi;
@ -619,8 +600,8 @@ namespace std
shuffle_order_engine<_RandomNumberEngine, __k>::
operator()()
{
size_t __j = (__k * (_M_y - _M_b.min()))
/ (_M_b.max() - _M_b.min() + 1);
size_t __j = __k * ((_M_y - _M_b.min())
/ (_M_b.max() - _M_b.min() + 1.0L));
_M_y = _M_v[__j];
_M_v[__j] = _M_b();
@ -1437,30 +1418,6 @@ namespace std
}
template<typename _RealType>
bool
operator==(const normal_distribution<_RealType>& __d1,
const normal_distribution<_RealType>& __d2)
{
if (__d1._M_param == __d2._M_param)
{
if (__d1._M_saved_available == __d2._M_saved_available)
{
if (__d1._M_saved_available
&& __d1._M_saved == __d2._M_saved)
return true;
else if(!__d1._M_saved_available)
return true;
else
return false;
}
else
return false;
}
else
return false;
}
/**
* Polar method due to Marsaglia.
*

View File

@ -1,51 +0,0 @@
// { dg-options "-std=c++0x" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// 26.4.8.2.1 Class template bernoulli_distribution [rand.dist.bern.bernoulli]
// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist]
#include <random>
#include <sstream>
#include <testsuite_hooks.h>
void
test01()
{
bool test __attribute__((unused)) = true;
std::stringstream str;
std::bernoulli_distribution u(0.75), v;
std::minstd_rand0 rng;
u(rng); // advance
str << u;
VERIFY( !(u == v) );
str >> v;
VERIFY( u == v );
}
int main()
{
test01();
return 0;
}

View File

@ -1,51 +0,0 @@
// { dg-options "-std=c++0x" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// 26.4.8.2.2 Class template binomial_distribution [rand.dist.bern.bin]
// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist]
#include <random>
#include <sstream>
#include <testsuite_hooks.h>
void
test01()
{
bool test __attribute__((unused)) = true;
std::stringstream str;
std::binomial_distribution<int> u(3, 0.75), v;
std::minstd_rand0 rng;
u(rng); // advance
str << u;
VERIFY( !(u == v) );
str >> v;
VERIFY( u == v );
}
int main()
{
test01();
return 0;
}

View File

@ -1,51 +0,0 @@
// { dg-options "-std=c++0x" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// 26.4.4.1 class template discard_block_engine [rand.adapt.disc]
// 26.4.2.3 concept RandomNumberEngineAdaptor [rand.concept.adapt]
#include <random>
#include <sstream>
#include <testsuite_hooks.h>
void
test01()
{
bool test __attribute__((unused)) = true;
std::stringstream str;
std::cauchy_distribution<double> u(5.0, 2.0), v;
std::minstd_rand0 rng;
u(rng); // advance
str << u;
VERIFY( !(u == v) );
str >> v;
VERIFY( u == v );
}
int main()
{
test01();
return 0;
}

View File

@ -1,51 +0,0 @@
// { dg-options "-std=c++0x" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// 26.4.8.4.3 Class template chi_squared_distribution [rand.dist.norm.chisq]
// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist]
#include <random>
#include <sstream>
#include <testsuite_hooks.h>
void
test01()
{
bool test __attribute__((unused)) = true;
std::stringstream str;
std::chi_squared_distribution<double> u(1.5), v;
std::minstd_rand0 rng;
u(rng); // advance
str << u;
VERIFY( !(u == v) );
str >> v;
VERIFY( u == v );
}
int main()
{
test01();
return 0;
}

View File

@ -1,52 +0,0 @@
// { dg-options "-std=c++0x" }
//
// 2008-12-05 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// 26.4.8.5.1 Class template discrete_distribution [rand.dist.samp.discrete]
// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist]
#include <random>
#include <sstream>
#include <testsuite_hooks.h>
void
test01()
{
bool test __attribute__((unused)) = true;
std::stringstream str;
std::vector<double> wt = {0.5, 1.0, 2.5, 1.5, 0.5};
std::discrete_distribution<int> u(wt.begin(), wt.end()), v;
std::minstd_rand0 rng;
u(rng); // advance
str << u;
VERIFY( !(u == v) );
str >> v;
VERIFY( u == v );
}
int main()
{
test01();
return 0;
}

View File

@ -1,51 +0,0 @@
// { dg-options "-std=c++0x" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// 26.4.8.3.2 Class template exponential_distribution [rand.dist.pois.exp]
// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist]
#include <random>
#include <sstream>
#include <testsuite_hooks.h>
void
test01()
{
bool test __attribute__((unused)) = true;
std::stringstream str;
std::exponential_distribution<double> u(0.5), v;
std::minstd_rand0 rng;
u(rng); // advance
str << u;
VERIFY( !(u == v) );
str >> v;
VERIFY( u == v );
}
int main()
{
test01();
return 0;
}

View File

@ -1,51 +0,0 @@
// { dg-options "-std=c++0x" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// 26.4.8.3.5 Class template extreme_value_distribution [rand.dist.pois.extreme]
// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist]
#include <random>
#include <sstream>
#include <testsuite_hooks.h>
void
test01()
{
bool test __attribute__((unused)) = true;
std::stringstream str;
std::extreme_value_distribution<double> u, v(5.0, 2.0);
std::minstd_rand0 rng;
u(rng); // advance
str << u;
VERIFY( !(u == v) );
str >> v;
VERIFY( u == v );
}
int main()
{
test01();
return 0;
}

View File

@ -1,51 +0,0 @@
// { dg-options "-std=c++0x" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// 26.4.8.4.5 Class template fisher_f_distribution [rand.dist.norm.f]
// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist]
#include <random>
#include <sstream>
#include <testsuite_hooks.h>
void
test01()
{
bool test __attribute__((unused)) = true;
std::stringstream str;
std::fisher_f_distribution<double> u(2.0, 3.0), v;
std::minstd_rand0 rng;
u(rng); // advance
str << u;
VERIFY( !(u == v) );
str >> v;
VERIFY( u == v );
}
int main()
{
test01();
return 0;
}

View File

@ -1,51 +0,0 @@
// { dg-options "-std=c++0x" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// 26.4.8.3.3 Class template gamma_distribution [rand.dist.pois.gamma]
// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist]
#include <random>
#include <sstream>
#include <testsuite_hooks.h>
void
test01()
{
bool test __attribute__((unused)) = true;
std::stringstream str;
std::gamma_distribution<double> u(1.5, 3.0), v;
std::minstd_rand0 rng;
u(rng); // advance
str << u;
VERIFY( !(u == v) );
str >> v;
VERIFY( u == v );
}
int main()
{
test01();
return 0;
}

View File

@ -1,51 +0,0 @@
// { dg-options "-std=c++0x" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// 26.4.8.2.3 Class template geometric_distribution [rand.dist.bern.geom]
// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist]
#include <random>
#include <sstream>
#include <testsuite_hooks.h>
void
test01()
{
bool test __attribute__((unused)) = true;
std::stringstream str;
std::geometric_distribution<int> u(0.75), v;
std::minstd_rand0 rng;
u(rng); // advance
str << u;
VERIFY( !(u == v) );
str >> v;
VERIFY( u == v );
}
int main()
{
test01();
return 0;
}

View File

@ -1,51 +0,0 @@
// { dg-options "-std=c++0x" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// 26.4.8.4.2 Class template lognormal_distribution [rand.dist.norm.lognormal]
// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist]
#include <random>
#include <sstream>
#include <testsuite_hooks.h>
void
test01()
{
bool test __attribute__((unused)) = true;
std::stringstream str;
std::lognormal_distribution<double> u(5.0, 2.0), v;
std::minstd_rand0 rng;
u(rng); // advance
str << u;
VERIFY( !(u == v) );
str >> v;
VERIFY( u == v );
}
int main()
{
test01();
return 0;
}

View File

@ -1,51 +0,0 @@
// { dg-options "-std=c++0x" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// 26.4.8.2.4 Class template negative_binomial_distribution [rand.dist.bern.negbin]
// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist]
#include <random>
#include <sstream>
#include <testsuite_hooks.h>
void
test01()
{
bool test __attribute__((unused)) = true;
std::stringstream str;
std::negative_binomial_distribution<int> u(3, 0.75), v;
std::minstd_rand0 rng;
u(rng); // advance
str << u;
VERIFY( !(u == v) );
str >> v;
VERIFY( u == v );
}
int main()
{
test01();
return 0;
}

View File

@ -1,51 +0,0 @@
// { dg-options "-std=c++0x" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// 26.4.8.4.1 Class template normal_distribution [rand.dist.norm.normal]
// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist]
#include <random>
#include <sstream>
#include <testsuite_hooks.h>
void
test01()
{
bool test __attribute__((unused)) = true;
std::stringstream str;
std::normal_distribution<double> u(5.0, 2.0), v;
std::minstd_rand0 rng;
u(rng); // advance
str << u;
VERIFY( !(u == v) );
str >> v;
VERIFY( u == v );
}
int main()
{
test01();
return 0;
}

View File

@ -1,54 +0,0 @@
// { dg-options "-std=c++0x" }
//
// 2008-12-05 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// 26.4.8.5.2 Class template piecewise_constant_distribution [rand.dist.samp.pconst]
// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist]
#include <random>
#include <sstream>
#include <testsuite_hooks.h>
void
test01()
{
bool test __attribute__((unused)) = true;
std::stringstream str;
std::vector<double> x = {0.0, 1.0, 2.0, 3.0, 4.0, 5.0};
std::vector<double> wt = {0.5, 1.0, 2.5, 1.5, 0.5};
std::piecewise_constant_distribution<double>
u(x.begin(), x.end(), wt.begin()), v;
std::minstd_rand0 rng;
u(rng); // advance
str << u;
VERIFY( !(u == v) );
str >> v;
VERIFY( u == v );
}
int main()
{
test01();
return 0;
}

View File

@ -1,57 +0,0 @@
// { dg-options "-std=c++0x" }
//
// 2008-12-05 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// 26.4.8.5.3 Class template piecewise_linear_distribution [rand.dist.samp.plinear]
// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist]
#include <random>
#include <sstream>
#include <testsuite_hooks.h>
void
test01()
{
bool test __attribute__((unused)) = true;
std::stringstream str;
typedef double value_type;
typedef std::piecewise_linear_distribution<double> distribution_type;
std::vector<double> x = {0.0, 1.0, 2.0, 3.0, 4.0, 5.0};
std::vector<double> wt = {0.0, 1.0, 2.5, 1.5, 0.5, 0.0};
distribution_type u(x.begin(), x.end(), wt.begin());
distribution_type v;
std::minstd_rand0 rng;
u(rng); // advance
str << u;
VERIFY( !(u == v) );
str >> v;
VERIFY( u == v );
}
int main()
{
test01();
return 0;
}

View File

@ -1,51 +0,0 @@
// { dg-options "-std=c++0x" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// 26.4.8.3.1 Class template poisson_distribution [rand.dist.pois.poisson]
// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist]
#include <random>
#include <sstream>
#include <testsuite_hooks.h>
void
test01()
{
bool test __attribute__((unused)) = true;
std::stringstream str;
std::poisson_distribution<int> u(5.0), v;
std::minstd_rand0 rng;
u(rng); // advance
str << u;
VERIFY( !(u == v) );
str >> v;
VERIFY( u == v );
}
int main()
{
test01();
return 0;
}

View File

@ -1,51 +0,0 @@
// { dg-options "-std=c++0x" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// 26.4.8.4.6 Class template student_t_distribution [rand.dist.norm.t]
// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist]
#include <random>
#include <sstream>
#include <testsuite_hooks.h>
void
test01()
{
bool test __attribute__((unused)) = true;
std::stringstream str;
std::student_t_distribution<double> u(1.5), v;
std::minstd_rand0 rng;
u(rng); // advance
str << u;
VERIFY( !(u == v) );
str >> v;
VERIFY( u == v );
}
int main()
{
test01();
return 0;
}

View File

@ -1,51 +0,0 @@
// { dg-options "-std=c++0x" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// 26.4.8.1.1 Class template uniform_int_distribution [rand.dist_uni]
// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist]
#include <random>
#include <sstream>
#include <testsuite_hooks.h>
void
test01()
{
bool test __attribute__((unused)) = true;
std::stringstream str;
std::uniform_int_distribution<int> u(1, 20), v;
std::minstd_rand0 rng;
u(rng); // advance
str << u;
VERIFY( !(u == v) );
str >> v;
VERIFY( u == v );
}
int main()
{
test01();
return 0;
}

View File

@ -1,51 +0,0 @@
// { dg-options "-std=c++0x" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// 26.4.8.1.2 Class template uniform_real_distribution [rand.dist.uni.real]
// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist]
#include <random>
#include <sstream>
#include <testsuite_hooks.h>
void
test01()
{
bool test __attribute__((unused)) = true;
std::stringstream str;
std::uniform_real_distribution<double> u(-5.0, 5.0), v;
std::minstd_rand0 rng;
u(rng); // advance
str << u;
VERIFY( !(u == v) );
str >> v;
VERIFY( u == v );
}
int main()
{
test01();
return 0;
}

View File

@ -1,51 +0,0 @@
// { dg-options "-std=c++0x" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// 26.4.8.3.4 Class template weibull_distribution [rand.dist.pois.weibull]
// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist]
#include <random>
#include <sstream>
#include <testsuite_hooks.h>
void
test01()
{
bool test __attribute__((unused)) = true;
std::stringstream str;
std::weibull_distribution<double> u(2.0, 3.5), v;
std::minstd_rand0 rng;
u(rng); // advance
str << u;
VERIFY( !(u == v) );
str >> v;
VERIFY( u == v );
}
int main()
{
test01();
return 0;
}