* The size of the state is @f$ 1 @f$.
*/
template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
+ class linear_congruential;
+
+ template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m,
+ typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const linear_congruential<_UIntType, __a, __c, __m>& __lcr);
+
+ template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m,
+ typename _CharT, typename _Traits>
+ std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ linear_congruential<_UIntType, __a, __c, __m>& __lcr);
+
+ template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
class linear_congruential
{
__glibcxx_class_requires(_UIntType, _UnsignedIntegerConcept)
* Writes the textual representation of the state x(i) of x to @p __os.
*
* @param __os The output stream.
- * @param __lcr A linear_congruential random number generator.
+ * @param __lcr A % linear_congruential random number generator.
* @returns __os.
*/
- template<typename _CharT, typename _Traits>
+ template<class _UIntType1, _UIntType1 __a1, _UIntType1 __c1,
+ _UIntType1 __m1,
+ typename _CharT, typename _Traits>
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
- const linear_congruential& __lcr)
- { return __os << __lcr._M_x; }
+ const linear_congruential<_UIntType1, __a1, __c1,
+ __m1>& __lcr);
/**
* Sets the state of the engine by reading its textual
* @p __is.
*
* @param __is The input stream.
- * @param __lcr A linear_congruential random number generator.
+ * @param __lcr A % linear_congruential random number generator.
* @returns __is.
*/
- template<typename _CharT, typename _Traits>
+ template<class _UIntType1, _UIntType1 __a1, _UIntType1 __c1,
+ _UIntType1 __m1,
+ typename _CharT, typename _Traits>
friend std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
- linear_congruential& __lcr)
- { return __is >> __lcr._M_x; }
+ linear_congruential<_UIntType1, __a1, __c1, __m1>& __lcr);
private:
template<class _Gen>
template<class _UIntType, int __w, int __n, int __m, int __r,
_UIntType __a, int __u, int __s, _UIntType __b, int __t,
_UIntType __c, int __l>
+ class mersenne_twister;
+
+ template<class _UIntType, int __w, int __n, int __m, int __r,
+ _UIntType __a, int __u, int __s, _UIntType __b, int __t,
+ _UIntType __c, int __l,
+ typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const mersenne_twister<_UIntType, __w, __n, __m,
+ __r, __a, __u, __s, __b, __t, __c, __l>& __x);
+
+ template<class _UIntType, int __w, int __n, int __m, int __r,
+ _UIntType __a, int __u, int __s, _UIntType __b, int __t,
+ _UIntType __c, int __l,
+ typename _CharT, typename _Traits>
+ std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ mersenne_twister<_UIntType, __w, __n, __m,
+ __r, __a, __u, __s, __b, __t, __c, __l>& __x);
+
+ template<class _UIntType, int __w, int __n, int __m, int __r,
+ _UIntType __a, int __u, int __s, _UIntType __b, int __t,
+ _UIntType __c, int __l>
class mersenne_twister
{
__glibcxx_class_requires(_UIntType, _UnsignedIntegerConcept)
* @returns The output stream with the state of @p __x inserted or in
* an error state.
*/
- template<typename _CharT, typename _Traits>
+ template<class _UIntType1, int __w1, int __n1, int __m1, int __r1,
+ _UIntType1 __a1, int __u1, int __s1, _UIntType1 __b1, int __t1,
+ _UIntType1 __c1, int __l1,
+ typename _CharT, typename _Traits>
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
- const mersenne_twister& __x)
- {
- std::copy(__x._M_x, __x._M_x + state_size,
- std::ostream_iterator<_UIntType>(__os, " "));
- return __os;
- }
+ const mersenne_twister<_UIntType1, __w1, __n1, __m1, __r1,
+ __a1, __u1, __s1, __b1, __t1, __c1, __l1>& __x);
/**
* Extracts the current state of a % mersenne_twister random number
* @returns The input stream with the state of @p __x extracted or in
* an error state.
*/
- template<typename _CharT, typename _Traits>
+ template<class _UIntType1, int __w1, int __n1, int __m1, int __r1,
+ _UIntType1 __a1, int __u1, int __s1, _UIntType1 __b1, int __t1,
+ _UIntType1 __c1, int __l1,
+ typename _CharT, typename _Traits>
friend std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
- mersenne_twister& __x)
- {
- for (int __i = 0; __i < state_size; ++__i)
- __is >> __x._M_x[__i];
- return __is;
- }
+ mersenne_twister<_UIntType1, __w1, __n1, __m1, __r1,
+ __a1, __u1, __s1, __b1, __t1, __c1, __l1>& __x);
private:
template<class _Gen>
* @endif
*/
template<typename _IntType, _IntType __m, int __s, int __r>
+ class subtract_with_carry;
+
+ template<typename _IntType, _IntType __m, int __s, int __r,
+ typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const subtract_with_carry<_IntType, __m, __s, __r>& __x);
+
+ template<typename _IntType, _IntType __m, int __s, int __r,
+ typename _CharT, typename _Traits>
+ std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ subtract_with_carry<_IntType, __m, __s, __r>& __x);
+
+ template<typename _IntType, _IntType __m, int __s, int __r>
class subtract_with_carry
{
__glibcxx_class_requires(_IntType, _IntegerConcept)
* @returns The output stream with the state of @p __x inserted or in
* an error state.
*/
- template<typename _CharT, typename _Traits>
+ template<typename _IntType1, _IntType1 __m1, int __s1, int __r1,
+ typename _CharT, typename _Traits>
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
- const subtract_with_carry& __x)
- {
- std::copy(__x._M_x, __x._M_x + long_lag,
- std::ostream_iterator<_IntType>(__os, " "));
- return __os << __x._M_carry;
- }
+ const subtract_with_carry<_IntType1, __m1, __s1,
+ __r1>& __x);
/**
* Extracts the current state of a % subtract_with_carry random number
* @returns The input stream with the state of @p __x extracted or in
* an error state.
*/
- template<typename _CharT, typename _Traits>
+ template<typename _IntType1, _IntType1 __m1, int __s1, int __r1,
+ typename _CharT, typename _Traits>
friend std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
- subtract_with_carry& __x)
- {
- for (int __i = 0; __i < long_lag; ++__i)
- __is >> __x._M_x[__i];
- __is >> __x._M_carry;
- return __is;
- }
+ subtract_with_carry<_IntType1, __m1, __s1, __r1>& __x);
private:
template<class _Gen>
* 0 <= @p __r <= @p __p
*/
template<class _UniformRandomNumberGenerator, int __p, int __r>
+ class discard_block;
+
+ template<class _UniformRandomNumberGenerator, int __p, int __r,
+ typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const discard_block<_UniformRandomNumberGenerator,
+ __p, __r>& __x);
+
+ template<class _UniformRandomNumberGenerator, int __p, int __r,
+ typename _CharT, typename _Traits>
+ std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ discard_block<_UniformRandomNumberGenerator, __p, __r>& __x);
+
+ template<class _UniformRandomNumberGenerator, int __p, int __r>
class discard_block
{
// __glibcxx_class_requires(typename base_type::result_type,
* @returns The output stream with the state of @p __x inserted or in
* an error state.
*/
- template<typename _CharT, typename _Traits>
+ template<class _UniformRandomNumberGenerator1, int __p1, int __r1,
+ typename _CharT, typename _Traits>
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
- const discard_block& __x)
- { return __os << __x._M_b << " " << __x._M_n; }
+ const discard_block<_UniformRandomNumberGenerator1,
+ __p1, __r1>& __x);
/**
* Extracts the current state of a % subtract_with_carry random number
* @returns The input stream with the state of @p __x extracted or in
* an error state.
*/
- template<typename _CharT, typename _Traits>
+ template<class _UniformRandomNumberGenerator1, int __p1, int __r1,
+ typename _CharT, typename _Traits>
friend std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
- discard_block& __x)
- { return __is >> __x._M_b >> __x._M_n; }
+ discard_block<_UniformRandomNumberGenerator1,
+ __p1, __r1>& __x);
private:
base_type _M_b;
*/
template<class _UniformRandomNumberGenerator1, int __s1,
class _UniformRandomNumberGenerator2, int __s2>
+ class xor_combine;
+
+ template<class _UniformRandomNumberGenerator1, int __s1,
+ class _UniformRandomNumberGenerator2, int __s2,
+ typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const xor_combine<_UniformRandomNumberGenerator1, __s1,
+ _UniformRandomNumberGenerator2, __s2>& __x);
+
+ template<class _UniformRandomNumberGenerator1, int __s1,
+ class _UniformRandomNumberGenerator2, int __s2,
+ typename _CharT, typename _Traits>
+ std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ xor_combine<_UniformRandomNumberGenerator1, __s1,
+ _UniformRandomNumberGenerator2, __s2>& __x);
+
+ template<class _UniformRandomNumberGenerator1, int __s1,
+ class _UniformRandomNumberGenerator2, int __s2>
class xor_combine
{
// __glibcxx_class_requires(typename _UniformRandomNumberGenerator1::
* @returns The output stream with the state of @p __x inserted or in
* an error state.
*/
- template<typename _CharT, typename _Traits>
+ template<class _UniformRandomNumberGenerator11, int __s11,
+ class _UniformRandomNumberGenerator21, int __s21,
+ typename _CharT, typename _Traits>
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
- const xor_combine& __x)
- { return __os << __x.base1() << " " << __x.base2(); }
+ const xor_combine<_UniformRandomNumberGenerator11, __s11,
+ _UniformRandomNumberGenerator21, __s21>& __x);
/**
* Extracts the current state of a %xor_combine random number
* @returns The input stream with the state of @p __x extracted or in
* an error state.
*/
- template<typename _CharT, typename _Traits>
+ template<class _UniformRandomNumberGenerator11, int __s11,
+ class _UniformRandomNumberGenerator21, int __s21,
+ typename _CharT, typename _Traits>
friend std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
- xor_combine& __x)
- { return __is >> __x._M_b1 >> __x._M_b2; }
+ xor_combine<_UniformRandomNumberGenerator11, __s11,
+ _UniformRandomNumberGenerator21, __s21>& __x);
private:
base1_type _M_b1;
* probability throughout the range.
*/
template<typename _IntType = int>
+ class uniform_int;
+
+ template<typename _IntType, typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const uniform_int<_IntType>& __x);
+
+ template<typename _IntType, typename _CharT, typename _Traits>
+ std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ uniform_int<_IntType>& __x);
+
+ template<typename _IntType>
class uniform_int
{
__glibcxx_class_requires(_IntType, _IntegerConcept)
* @returns The output stream with the state of @p __x inserted or in
* an error state.
*/
- template<typename _CharT, typename _Traits>
+ template<typename _IntType1, typename _CharT, typename _Traits>
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
- const uniform_int& __x)
- { return __os << __x.min() << " " << __x.max(); }
+ const uniform_int<_IntType1>& __x);
/**
* Extracts a %unform_int random number distribution
- * @p __u from the input stream @p __is.
+ * @p __x from the input stream @p __is.
*
* @param __is An input stream.
- * @param __u A %uniform_int random number generator engine.
+ * @param __x A %uniform_int random number generator engine.
*
- * @returns The input stream with @p __u extracted or in an error state.
+ * @returns The input stream with @p __x extracted or in an error state.
*/
- template<typename _CharT, typename _Traits>
+ template<typename _IntType1, typename _CharT, typename _Traits>
friend std::basic_istream<_CharT, _Traits>&
- operator>>(std::basic_istream<_CharT, _Traits>& __is, uniform_int& __u)
- { return __is >> __u._M_min >> __u._M_max; }
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ uniform_int<_IntType1>& __x);
private:
_IntType _M_min;
* Generates a sequence of true and false values with likelihood @f$ p @f$
* that true will come up and @f$ (1 - p) @f$ that false will appear.
*/
+ class bernoulli_distribution;
+
+ template<typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const bernoulli_distribution& __x);
+
class bernoulli_distribution
{
public:
template<typename _CharT, typename _Traits>
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
- const bernoulli_distribution& __x)
- { return __os << __x.p(); }
+ const bernoulli_distribution& __x);
/**
* Extracts a %bernoulli_distribution random number distribution
- * @p __u from the input stream @p __is.
+ * @p __x from the input stream @p __is.
*
* @param __is An input stream.
- * @param __u A %bernoulli_distribution random number generator engine.
+ * @param __x A %bernoulli_distribution random number generator engine.
*
- * @returns The input stream with @p __u extracted or in an error state.
+ * @returns The input stream with @p __x extracted or in an error state.
*/
template<typename _CharT, typename _Traits>
friend std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
- bernoulli_distribution& __u)
- { return __is >> __u._M_p; }
+ bernoulli_distribution& __x)
+ { return __is >> __x._M_p; }
protected:
double _M_p;
* distribution.
*/
template<typename _IntType = int, typename _RealType = double>
+ class geometric_distribution;
+
+ template<typename _IntType, typename _RealType,
+ typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const geometric_distribution<_IntType, _RealType>& __x);
+
+ template<typename _IntType, typename _RealType>
class geometric_distribution
{
public:
* @returns The output stream with the state of @p __x inserted or in
* an error state.
*/
- template<typename _CharT, typename _Traits>
+ template<typename _IntType1, typename _RealType1,
+ typename _CharT, typename _Traits>
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
- const geometric_distribution& __x)
- { return __os << __x.p(); }
+ const geometric_distribution<_IntType1, _RealType1>& __x);
/**
* Extracts a %geometric_distribution random number distribution
- * @p __u from the input stream @p __is.
+ * @p __x from the input stream @p __is.
*
* @param __is An input stream.
- * @param __u A %geometric_distribution random number generator engine.
+ * @param __x A %geometric_distribution random number generator engine.
*
- * @returns The input stream with @p __u extracted or in an error state.
+ * @returns The input stream with @p __x extracted or in an error state.
*/
template<typename _CharT, typename _Traits>
friend std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
- geometric_distribution& __u)
+ geometric_distribution& __x)
{
- __is >> __u._M_p;
- __u._M_log_p = std::log(__u._M_p);
+ __is >> __x._M_p;
+ __x._M_log_p = std::log(__x._M_p);
return __is;
}
* deliver number in the range [0, 1).
*/
template<typename _RealType = double>
+ class uniform_real;
+
+ template<typename _RealType, typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const uniform_real<_RealType>& __x);
+
+ template<typename _RealType, typename _CharT, typename _Traits>
+ std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ uniform_real<_RealType>& __x);
+
+ template<typename _RealType>
class uniform_real
{
public:
* @returns The output stream with the state of @p __x inserted or in
* an error state.
*/
- template<typename _CharT, typename _Traits>
+ template<typename _RealType1, typename _CharT, typename _Traits>
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
- const uniform_real& __x)
- { return __os << __x.min() << " " << __x.max(); }
+ const uniform_real<_RealType1>& __x);
/**
* Extracts a %unform_real random number distribution
- * @p __u from the input stream @p __is.
+ * @p __x from the input stream @p __is.
*
* @param __is An input stream.
- * @param __u A %uniform_real random number generator engine.
+ * @param __x A %uniform_real random number generator engine.
*
- * @returns The input stream with @p __u extracted or in an error state.
+ * @returns The input stream with @p __x extracted or in an error state.
*/
- template<typename _CharT, typename _Traits>
+ template<typename _RealType1, typename _CharT, typename _Traits>
friend std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
- uniform_real& __u)
- { return __is >> __u._M_min >> __u._M_max; }
+ uniform_real<_RealType1>& __x);
protected:
_RealType _M_min;
* </table>
*/
template<typename _RealType = double>
+ class exponential_distribution;
+
+ template<typename _RealType, typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const exponential_distribution<_RealType>& __x);
+
+ template<typename _RealType>
class exponential_distribution
{
public:
* @returns The output stream with the state of @p __x inserted or in
* an error state.
*/
- template<typename _CharT, typename _Traits>
+ template<typename _RealType1, typename _CharT, typename _Traits>
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
- const exponential_distribution& __x)
- { return __os << __x.lambda(); }
+ const exponential_distribution<_RealType1>& __x);
/**
* Extracts a %exponential_distribution random number distribution
- * @p __u from the input stream @p __is.
+ * @p __x from the input stream @p __is.
*
* @param __is An input stream.
- * @param __u A %exponential_distribution random number generator engine.
+ * @param __x A %exponential_distribution random number generator engine.
*
- * @returns The input stream with @p __u extracted or in an error state.
+ * @returns The input stream with @p __x extracted or in an error state.
*/
template<typename _CharT, typename _Traits>
friend std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
- exponential_distribution& __u)
- { return __is >> __u._M_lambda; }
+ exponential_distribution& __x)
+ { return __is >> __x._M_lambda; }
private:
result_type _M_lambda;
* e^{- \frac{{x - mean}^ {2}}{2 \sigma ^ {2}} } @f$.
*/
template<typename _RealType = double>
+ class normal_distribution;
+
+ template<typename _RealType, typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const normal_distribution<_RealType>& __x);
+
+ template<typename _RealType, typename _CharT, typename _Traits>
+ std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ normal_distribution<_RealType>& __x);
+
+ template<typename _RealType>
class normal_distribution
{
public:
* @returns The output stream with the state of @p __x inserted or in
* an error state.
*/
- template<typename _CharT, typename _Traits>
+ template<typename _RealType1, typename _CharT, typename _Traits>
friend std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os,
- const normal_distribution& __x)
- {
- return __os << __x.mean() << " " << __x.sigma()
- << " " << __x._M_saved << " " << __x._M_saved_available;
- }
+ const normal_distribution<_RealType1>& __x);
/**
* Extracts a %normal_distribution random number distribution
- * @p __u from the input stream @p __is.
+ * @p __x from the input stream @p __is.
*
* @param __is An input stream.
- * @param __u A %normal_distribution random number generator engine.
+ * @param __x A %normal_distribution random number generator engine.
*
- * @returns The input stream with @p __u extracted or in an error state.
+ * @returns The input stream with @p __x extracted or in an error state.
*/
- template<typename _CharT, typename _Traits>
+ template<typename _RealType1, typename _CharT, typename _Traits>
friend std::basic_istream<_CharT, _Traits>&
operator>>(std::basic_istream<_CharT, _Traits>& __is,
- normal_distribution& __u)
- {
- return __is >> __u._M_mean >> __u._M_sigma
- >> __u._M_saved >> __u._M_saved_available;
- }
+ normal_distribution<_RealType1>& __x);
private:
result_type _M_mean;
__mod(_Tp __x)
{ return _Mod<_Tp, __a, __c, __m, __m == 0>::__calc(__x); }
+ // See N1822.
+ template<typename _RealType>
+ struct _Max_digits10
+ {
+ static const std::streamsize __value =
+ 2 + std::numeric_limits<_RealType>::digits * 3010/10000;
+ };
+
} // namespace _Private
return _M_x;
}
+ template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m,
+ typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const linear_congruential<_UIntType, __a, __c, __m>& __lcr)
+ {
+ const std::ios_base::fmtflags __flags = __os.flags();
+ const _CharT __fill = __os.fill();
+ __os.flags(std::ios_base::dec | std::ios_base::fixed
+ | std::ios_base::left);
+ __os.fill(__os.widen(' '));
+
+ __os << __lcr._M_x;
+
+ __os.flags(__flags);
+ __os.fill(__fill);
+ return __os;
+ }
+
+ template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m,
+ typename _CharT, typename _Traits>
+ std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ linear_congruential<_UIntType, __a, __c, __m>& __lcr)
+ {
+ const std::ios_base::fmtflags __flags = __is.flags();
+ __is.flags(std::ios_base::dec);
+
+ __is >> __lcr._M_x;
+
+ __is.flags(__flags);
+ return __is;
+ }
+
template<class _UIntType, int __w, int __n, int __m, int __r,
_UIntType __a, int __u, int __s,
return __z;
}
+ template<class _UIntType, int __w, int __n, int __m, int __r,
+ _UIntType __a, int __u, int __s, _UIntType __b, int __t,
+ _UIntType __c, int __l,
+ typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const mersenne_twister<_UIntType, __w, __n, __m,
+ __r, __a, __u, __s, __b, __t, __c, __l>& __x)
+ {
+ const std::ios_base::fmtflags __flags = __os.flags();
+ const _CharT __fill = __os.fill();
+ const _CharT __space = __os.widen(' ');
+ __os.flags(std::ios_base::dec | std::ios_base::fixed
+ | std::ios_base::left);
+ __os.fill(__space);
+
+ for (int __i = 0; __i < __n - 1; ++__i)
+ __os << __x._M_x[__i] << __space;
+ __os << __x._M_x[__n - 1];
+
+ __os.flags(__flags);
+ __os.fill(__fill);
+ return __os;
+ }
+
+ template<class _UIntType, int __w, int __n, int __m, int __r,
+ _UIntType __a, int __u, int __s, _UIntType __b, int __t,
+ _UIntType __c, int __l,
+ typename _CharT, typename _Traits>
+ std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ mersenne_twister<_UIntType, __w, __n, __m,
+ __r, __a, __u, __s, __b, __t, __c, __l>& __x)
+ {
+ const std::ios_base::fmtflags __flags = __is.flags();
+ __is.flags(std::ios_base::dec | std::ios_base::skipws);
+
+ for (int __i = 0; __i < __n; ++__i)
+ __is >> __x._M_x[__i];
+
+ __is.flags(__flags);
+ return __is;
+ }
+
template<typename _IntType, _IntType __m, int __s, int __r>
void
return __xi;
}
+ template<typename _IntType, _IntType __m, int __s, int __r,
+ typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const subtract_with_carry<_IntType, __m, __s, __r>& __x)
+ {
+ const std::ios_base::fmtflags __flags = __os.flags();
+ const _CharT __fill = __os.fill();
+ const _CharT __space = __os.widen(' ');
+ __os.flags(std::ios_base::dec | std::ios_base::fixed
+ | std::ios_base::left);
+ __os.fill(__space);
+
+ for (int __i = 0; __i < __r; ++__i)
+ __os << __x._M_x[__i] << __space;
+ __os << __x._M_carry;
+
+ __os.flags(__flags);
+ __os.fill(__fill);
+ return __os;
+ }
+
+ template<typename _IntType, _IntType __m, int __s, int __r,
+ typename _CharT, typename _Traits>
+ std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ subtract_with_carry<_IntType, __m, __s, __r>& __x)
+ {
+ const std::ios_base::fmtflags __flags = __is.flags();
+ __is.flags(std::ios_base::dec | std::ios_base::skipws);
+
+ for (int __i = 0; __i < __r; ++__i)
+ __is >> __x._M_x[__i];
+ __is >> __x._M_carry;
+
+ __is.flags(__flags);
+ return __is;
+ }
+
template<class _UniformRandomNumberGenerator, int __p, int __r>
typename discard_block<_UniformRandomNumberGenerator,
return _M_b();
}
+ template<class _UniformRandomNumberGenerator, int __p, int __r,
+ typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const discard_block<_UniformRandomNumberGenerator,
+ __p, __r>& __x)
+ {
+ const std::ios_base::fmtflags __flags = __os.flags();
+ const _CharT __fill = __os.fill();
+ const _CharT __space = __os.widen(' ');
+ __os.flags(std::ios_base::dec | std::ios_base::fixed
+ | std::ios_base::left);
+ __os.fill(__space);
+
+ __os << __x._M_b << __space << __x._M_n;
+
+ __os.flags(__flags);
+ __os.fill(__fill);
+ return __os;
+ }
+
+ template<class _UniformRandomNumberGenerator, int __p, int __r,
+ typename _CharT, typename _Traits>
+ std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ discard_block<_UniformRandomNumberGenerator, __p, __r>& __x)
+ {
+ const std::ios_base::fmtflags __flags = __is.flags();
+ __is.flags(std::ios_base::dec | std::ios_base::skipws);
+
+ __is >> __x._M_b >> __x._M_n;
+
+ __is.flags(__flags);
+ return __is;
+ }
+
+
+ template<class _UniformRandomNumberGenerator1, int __s1,
+ class _UniformRandomNumberGenerator2, int __s2,
+ typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const xor_combine<_UniformRandomNumberGenerator1, __s1,
+ _UniformRandomNumberGenerator2, __s2>& __x)
+ {
+ const std::ios_base::fmtflags __flags = __os.flags();
+ const _CharT __fill = __os.fill();
+ const _CharT __space = __os.widen(' ');
+ __os.flags(std::ios_base::dec | std::ios_base::fixed
+ | std::ios_base::left);
+ __os.fill(__space);
+
+ __os << __x.base1() << __space << __x.base2();
+
+ __os.flags(__flags);
+ __os.fill(__fill);
+ return __os;
+ }
+
+ template<class _UniformRandomNumberGenerator1, int __s1,
+ class _UniformRandomNumberGenerator2, int __s2,
+ typename _CharT, typename _Traits>
+ std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ xor_combine<_UniformRandomNumberGenerator1, __s1,
+ _UniformRandomNumberGenerator2, __s2>& __x)
+ {
+ const std::ios_base::fmtflags __flags = __is.flags();
+ __is.flags(std::ios_base::skipws);
+
+ __is >> __x._M_b1 >> __x._M_b2;
+
+ __is.flags(__flags);
+ return __is;
+ }
+
+
+ template<typename _IntType, typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const uniform_int<_IntType>& __x)
+ {
+ const std::ios_base::fmtflags __flags = __os.flags();
+ const _CharT __fill = __os.fill();
+ const _CharT __space = __os.widen(' ');
+ __os.flags(std::ios_base::scientific | std::ios_base::left);
+ __os.fill(__space);
+
+ __os << __x.min() << __space << __x.max();
+
+ __os.flags(__flags);
+ __os.fill(__fill);
+ return __os;
+ }
+
+ template<typename _IntType, typename _CharT, typename _Traits>
+ std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ uniform_int<_IntType>& __x)
+ {
+ const std::ios_base::fmtflags __flags = __is.flags();
+ __is.flags(std::ios_base::dec | std::ios_base::skipws);
+
+ __is >> __x._M_min >> __x._M_max;
+
+ __is.flags(__flags);
+ return __is;
+ }
+
+
+ template<typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const bernoulli_distribution& __x)
+ {
+ const std::ios_base::fmtflags __flags = __os.flags();
+ const _CharT __fill = __os.fill();
+ const std::streamsize __precision = __os.precision();
+ __os.flags(std::ios_base::scientific | std::ios_base::left);
+ __os.fill(__os.widen(' '));
+ __os.precision(_Private::_Max_digits10<double>::__value);
+
+ __os << __x.p();
+
+ __os.flags(__flags);
+ __os.fill(__fill);
+ __os.precision(__precision);
+ return __os;
+ }
+
+
+ template<typename _IntType, typename _RealType,
+ typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const geometric_distribution<_IntType, _RealType>& __x)
+ {
+ const std::ios_base::fmtflags __flags = __os.flags();
+ const _CharT __fill = __os.fill();
+ const std::streamsize __precision = __os.precision();
+ __os.flags(std::ios_base::scientific | std::ios_base::left);
+ __os.fill(__os.widen(' '));
+ __os.precision(_Private::_Max_digits10<_RealType>::__value);
+
+ __os << __x.p();
+
+ __os.flags(__flags);
+ __os.fill(__fill);
+ __os.precision(__precision);
+ return __os;
+ }
+
+
+ template<typename _RealType, typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const uniform_real<_RealType>& __x)
+ {
+ const std::ios_base::fmtflags __flags = __os.flags();
+ const _CharT __fill = __os.fill();
+ const std::streamsize __precision = __os.precision();
+ const _CharT __space = __os.widen(' ');
+ __os.flags(std::ios_base::scientific | std::ios_base::left);
+ __os.fill(__space);
+ __os.precision(_Private::_Max_digits10<_RealType>::__value);
+
+ __os << __x.min() << __space << __x.max();
+
+ __os.flags(__flags);
+ __os.fill(__fill);
+ __os.precision(__precision);
+ return __os;
+ }
+
+ template<typename _RealType, typename _CharT, typename _Traits>
+ std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ uniform_real<_RealType>& __x)
+ {
+ const std::ios_base::fmtflags __flags = __is.flags();
+ __is.flags(std::ios_base::skipws);
+
+ __is >> __x._M_min >> __x._M_max;
+
+ __is.flags(__flags);
+ return __is;
+ }
+
+
+ template<typename _RealType, typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const exponential_distribution<_RealType>& __x)
+ {
+ const std::ios_base::fmtflags __flags = __os.flags();
+ const _CharT __fill = __os.fill();
+ const std::streamsize __precision = __os.precision();
+ __os.flags(std::ios_base::scientific | std::ios_base::left);
+ __os.fill(__os.widen(' '));
+ __os.precision(_Private::_Max_digits10<_RealType>::__value);
+
+ __os << __x.lambda();
+
+ __os.flags(__flags);
+ __os.fill(__fill);
+ __os.precision(__precision);
+ return __os;
+ }
+
/**
* Classic Box-Muller method.
return __ret * _M_sigma + _M_mean;
}
+ template<typename _RealType, typename _CharT, typename _Traits>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const normal_distribution<_RealType>& __x)
+ {
+ const std::ios_base::fmtflags __flags = __os.flags();
+ const _CharT __fill = __os.fill();
+ const std::streamsize __precision = __os.precision();
+ const _CharT __space = __os.widen(' ');
+ __os.flags(std::ios_base::scientific | std::ios_base::left);
+ __os.fill(__space);
+ __os.precision(_Private::_Max_digits10<_RealType>::__value);
+
+ __os << __x.mean() << __space
+ << __x.sigma() << __space
+ << __x._M_saved << __space
+ << __x._M_saved_available;
+
+ __os.flags(__flags);
+ __os.fill(__fill);
+ __os.precision(__precision);
+ return __os;
+ }
+
+ template<typename _RealType, typename _CharT, typename _Traits>
+ std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is,
+ normal_distribution<_RealType>& __x)
+ {
+ const std::ios_base::fmtflags __flags = __is.flags();
+ __is.flags(std::ios_base::dec | std::ios_base::skipws);
+
+ __is >> __x._M_mean >> __x._M_sigma
+ >> __x._M_saved >> __x._M_saved_available;
+
+ __is.flags(__flags);
+ return __is;
+ }
+
_GLIBCXX_END_NAMESPACE
}