+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
// 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 =
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
*/
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.
*/
result_type
max() const
- { return __m - 1; }
+ { return __m - 1u; }
/**
* @brief Discard a sequence of random numbers.
__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;
};
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
__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;
};
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
*/
result_type
max() const
- { return _S_modulus - 1U; }
+ { return __detail::_ShiftMin1<_UIntType, __w>::__value; }
/**
* @brief Discard a sequence of random numbers.
__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;
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;
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.
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;
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.
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;
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.
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;
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.
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;
};
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.
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;
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.
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;
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.
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;
};
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.
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;
};
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.
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();
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)
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()
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.
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;
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.
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
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.
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;
};
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.
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();
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.
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;
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.
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;
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.
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();
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.
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();
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.
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();
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
} // 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
: 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.
*/
(__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;
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)
(__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;
}
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;
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();
}
- 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.
*
+++ /dev/null
-// { 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;
-}
+++ /dev/null
-// { 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;
-}
+++ /dev/null
-// { 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;
-}
+++ /dev/null
-// { 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;
-}
+++ /dev/null
-// { 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;
-}
+++ /dev/null
-// { 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;
-}
+++ /dev/null
-// { 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;
-}
+++ /dev/null
-// { 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;
-}
+++ /dev/null
-// { 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;
-}
+++ /dev/null
-// { 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;
-}
+++ /dev/null
-// { 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;
-}
+++ /dev/null
-// { 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;
-}
+++ /dev/null
-// { 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;
-}
+++ /dev/null
-// { 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;
-}
+++ /dev/null
-// { 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;
-}
+++ /dev/null
-// { 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;
-}
+++ /dev/null
-// { 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;
-}
+++ /dev/null
-// { 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;
-}
+++ /dev/null
-// { 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;
-}
+++ /dev/null
-// { 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;
-}