36 namespace std _GLIBCXX_VISIBILITY(default)
38 _GLIBCXX_BEGIN_NAMESPACE_VERSION
55 template<
typename _RealType,
size_t __bits,
56 typename _UniformRandomNumberGenerator>
60 _GLIBCXX_END_NAMESPACE_VERSION
67 _GLIBCXX_BEGIN_NAMESPACE_VERSION
69 template<
typename _UIntType,
size_t __w,
70 bool = __w < static_cast<size_t>
73 {
static const _UIntType __value = 0; };
75 template<
typename _UIntType,
size_t __w>
76 struct _Shift<_UIntType, __w, true>
77 {
static const _UIntType __value = _UIntType(1) << __w; };
79 template<
typename _Tp, _Tp __m, _Tp __a, _Tp __c,
bool>
84 template<
typename _Tp, _Tp __m, _Tp __a = 1, _Tp __c = 0>
87 {
return _Mod<_Tp, __m, __a, __c, __m == 0>::__calc(__x); }
93 template<
typename _Engine,
typename _DInputType>
98 _Adaptor(_Engine& __g)
103 {
return _DInputType(0); }
107 {
return _DInputType(1); }
126 _GLIBCXX_END_NAMESPACE_VERSION
129 _GLIBCXX_BEGIN_NAMESPACE_VERSION
169 template<
typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
173 "substituting _UIntType not an unsigned integral type");
174 static_assert(__m == 0u || (__a < __m && __c < __m),
175 "template argument substituting __m out of bounds");
179 static_assert(__m % __a < __m / __a,
180 "sorry, not implemented yet: try a smaller 'a' constant");
211 template<
typename _Sseq,
typename =
typename
234 template<
typename _Sseq>
246 {
return __c == 0u ? 1u : 0u; }
261 for (; __z != 0ULL; --__z)
271 _M_x = __detail::__mod<_UIntType, __m, __a, __c>(_M_x);
289 {
return __lhs._M_x == __rhs._M_x; }
299 template<
typename _UIntType1, _UIntType1 __a1, _UIntType1 __c1,
300 _UIntType1 __m1,
typename _CharT,
typename _Traits>
302 operator<<(std::basic_ostream<_CharT, _Traits>&,
319 template<
typename _UIntType1, _UIntType1 __a1, _UIntType1 __c1,
320 _UIntType1 __m1,
typename _CharT,
typename _Traits>
341 template<
typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
347 {
return !(__lhs == __rhs); }
375 template<
typename _UIntType,
size_t __w,
376 size_t __n,
size_t __m,
size_t __r,
377 _UIntType __a,
size_t __u, _UIntType __d,
size_t __s,
378 _UIntType __b,
size_t __t,
379 _UIntType __c,
size_t __l, _UIntType __f>
380 class mersenne_twister_engine
383 "substituting _UIntType not an unsigned integral type");
384 static_assert(1u <= __m && __m <= __n,
385 "template argument substituting __m out of bounds");
386 static_assert(__r <= __w,
"template argument substituting "
388 static_assert(__u <= __w,
"template argument substituting "
390 static_assert(__s <= __w,
"template argument substituting "
392 static_assert(__t <= __w,
"template argument substituting "
394 static_assert(__l <= __w,
"template argument substituting "
397 "template argument substituting __w out of bound");
398 static_assert(__a <= (__detail::_Shift<_UIntType, __w>::__value - 1),
399 "template argument substituting __a out of bound");
400 static_assert(__b <= (__detail::_Shift<_UIntType, __w>::__value - 1),
401 "template argument substituting __b out of bound");
402 static_assert(__c <= (__detail::_Shift<_UIntType, __w>::__value - 1),
403 "template argument substituting __c out of bound");
404 static_assert(__d <= (__detail::_Shift<_UIntType, __w>::__value - 1),
405 "template argument substituting __d out of bound");
406 static_assert(__f <= (__detail::_Shift<_UIntType, __w>::__value - 1),
407 "template argument substituting __f out of bound");
411 typedef _UIntType result_type;
414 static constexpr
size_t word_size = __w;
415 static constexpr
size_t state_size = __n;
416 static constexpr
size_t shift_size = __m;
417 static constexpr
size_t mask_bits = __r;
418 static constexpr result_type xor_mask = __a;
419 static constexpr
size_t tempering_u = __u;
420 static constexpr result_type tempering_d = __d;
421 static constexpr
size_t tempering_s = __s;
422 static constexpr result_type tempering_b = __b;
423 static constexpr
size_t tempering_t = __t;
424 static constexpr result_type tempering_c = __c;
425 static constexpr
size_t tempering_l = __l;
426 static constexpr result_type initialization_multiplier = __f;
427 static constexpr result_type default_seed = 5489u;
431 mersenne_twister_engine(result_type __sd = default_seed)
440 template<
typename _Sseq,
typename =
typename
444 mersenne_twister_engine(_Sseq& __q)
448 seed(result_type __sd = default_seed);
450 template<
typename _Sseq>
457 static constexpr result_type
464 static constexpr result_type
466 {
return __detail::_Shift<_UIntType, __w>::__value - 1; }
472 discard(
unsigned long long __z)
474 for (; __z != 0ULL; --__z)
494 operator==(
const mersenne_twister_engine& __lhs,
495 const mersenne_twister_engine& __rhs)
496 {
return std::equal(__lhs._M_x, __lhs._M_x + state_size, __rhs._M_x); }
510 template<
typename _UIntType1,
511 size_t __w1,
size_t __n1,
512 size_t __m1,
size_t __r1,
513 _UIntType1 __a1,
size_t __u1,
514 _UIntType1 __d1,
size_t __s1,
515 _UIntType1 __b1,
size_t __t1,
516 _UIntType1 __c1,
size_t __l1, _UIntType1 __f1,
517 typename _CharT,
typename _Traits>
519 operator<<(std::basic_ostream<_CharT, _Traits>&,
520 const std::mersenne_twister_engine<_UIntType1, __w1, __n1,
521 __m1, __r1, __a1, __u1, __d1, __s1, __b1, __t1, __c1,
536 template<
typename _UIntType1,
537 size_t __w1,
size_t __n1,
538 size_t __m1,
size_t __r1,
539 _UIntType1 __a1,
size_t __u1,
540 _UIntType1 __d1,
size_t __s1,
541 _UIntType1 __b1,
size_t __t1,
542 _UIntType1 __c1,
size_t __l1, _UIntType1 __f1,
543 typename _CharT,
typename _Traits>
546 std::mersenne_twister_engine<_UIntType1, __w1, __n1, __m1,
547 __r1, __a1, __u1, __d1, __s1, __b1, __t1, __c1,
551 _UIntType _M_x[state_size];
567 template<
typename _UIntType,
size_t __w,
568 size_t __n,
size_t __m,
size_t __r,
569 _UIntType __a,
size_t __u, _UIntType __d,
size_t __s,
570 _UIntType __b,
size_t __t,
571 _UIntType __c,
size_t __l, _UIntType __f>
573 operator!=(
const std::mersenne_twister_engine<_UIntType, __w, __n, __m,
574 __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>& __lhs,
575 const std::mersenne_twister_engine<_UIntType, __w, __n, __m,
576 __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>& __rhs)
577 {
return !(__lhs == __rhs); }
599 template<
typename _UIntType,
size_t __w,
size_t __s,
size_t __r>
600 class subtract_with_carry_engine
603 "substituting _UIntType not an unsigned integral type");
604 static_assert(0u < __s && __s < __r,
605 "template argument substituting __s out of bounds");
607 "template argument substituting __w out of bounds");
611 typedef _UIntType result_type;
614 static constexpr
size_t word_size = __w;
615 static constexpr
size_t short_lag = __s;
616 static constexpr
size_t long_lag = __r;
617 static constexpr result_type default_seed = 19780503u;
624 subtract_with_carry_engine(result_type __sd = default_seed)
633 template<
typename _Sseq,
typename =
typename
637 subtract_with_carry_engine(_Sseq& __q)
653 seed(result_type __sd = default_seed);
659 template<
typename _Sseq>
667 static constexpr result_type
675 static constexpr result_type
677 {
return __detail::_Shift<_UIntType, __w>::__value - 1; }
683 discard(
unsigned long long __z)
685 for (; __z != 0ULL; --__z)
708 operator==(
const subtract_with_carry_engine& __lhs,
709 const subtract_with_carry_engine& __rhs)
710 {
return std::equal(__lhs._M_x, __lhs._M_x + long_lag, __rhs._M_x); }
724 template<
typename _UIntType1,
size_t __w1,
size_t __s1,
size_t __r1,
725 typename _CharT,
typename _Traits>
727 operator<<(std::basic_ostream<_CharT, _Traits>&,
728 const std::subtract_with_carry_engine<_UIntType1, __w1,
743 template<
typename _UIntType1,
size_t __w1,
size_t __s1,
size_t __r1,
744 typename _CharT,
typename _Traits>
747 std::subtract_with_carry_engine<_UIntType1, __w1,
751 _UIntType _M_x[long_lag];
768 template<
typename _UIntType,
size_t __w,
size_t __s,
size_t __r>
770 operator!=(
const std::subtract_with_carry_engine<_UIntType, __w,
772 const std::subtract_with_carry_engine<_UIntType, __w,
774 {
return !(__lhs == __rhs); }
783 template<
typename _RandomNumberEngine,
size_t __p,
size_t __r>
786 static_assert(1 <= __r && __r <= __p,
787 "template argument substituting __r out of bounds");
791 typedef typename _RandomNumberEngine::result_type
result_type;
794 static constexpr
size_t block_size = __p;
795 static constexpr
size_t used_block = __r;
803 : _M_b(), _M_n(0) { }
813 : _M_b(__rne), _M_n(0) { }
823 : _M_b(std::move(__rne)), _M_n(0) { }
833 : _M_b(__s), _M_n(0) { }
840 template<
typename _Sseq,
typename =
typename
876 template<
typename _Sseq>
888 const _RandomNumberEngine&
912 for (; __z != 0ULL; --__z)
936 {
return __lhs._M_b == __rhs._M_b && __lhs._M_n == __rhs._M_n; }
949 template<
typename _RandomNumberEngine1,
size_t __p1,
size_t __r1,
950 typename _CharT,
typename _Traits>
952 operator<<(std::basic_ostream<_CharT, _Traits>&,
967 template<
typename _RandomNumberEngine1,
size_t __p1,
size_t __r1,
968 typename _CharT,
typename _Traits>
975 _RandomNumberEngine _M_b;
990 template<
typename _RandomNumberEngine,
size_t __p,
size_t __r>
996 {
return !(__lhs == __rhs); }
1003 template<
typename _RandomNumberEngine,
size_t __w,
typename _UIntType>
1007 "substituting _UIntType not an unsigned integral type");
1009 "template argument substituting __w out of bounds");
1041 : _M_b(std::move(__rne)) { }
1058 template<
typename _Sseq,
typename =
typename
1088 template<
typename _Sseq>
1097 const _RandomNumberEngine&
1113 {
return __detail::_Shift<_UIntType, __w>::__value - 1; }
1121 for (; __z != 0ULL; --__z)
1146 {
return __lhs._M_b == __rhs._M_b; }
1160 template<
typename _CharT,
typename _Traits>
1164 __w, _UIntType>& __x)
1171 _RandomNumberEngine _M_b;
1186 template<
typename _RandomNumberEngine,
size_t __w,
typename _UIntType>
1192 {
return !(__lhs == __rhs); }
1204 template<
typename _RandomNumberEngine,
size_t __w,
typename _UIntType,
1205 typename _CharT,
typename _Traits>
1207 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
1209 __w, _UIntType>& __x)
1221 template<
typename _RandomNumberEngine,
size_t __k>
1224 static_assert(1u <= __k,
"template argument substituting "
1225 "__k out of bound");
1229 typedef typename _RandomNumberEngine::result_type
result_type;
1231 static constexpr
size_t table_size = __k;
1240 { _M_initialize(); }
1251 { _M_initialize(); }
1261 : _M_b(std::move(__rne))
1262 { _M_initialize(); }
1273 { _M_initialize(); }
1280 template<
typename _Sseq,
typename =
typename
1287 { _M_initialize(); }
1316 template<
typename _Sseq>
1327 const _RandomNumberEngine&
1351 for (; __z != 0ULL; --__z)
1375 {
return __lhs._M_b == __rhs._M_b; }
1388 template<
typename _RandomNumberEngine1,
size_t __k1,
1389 typename _CharT,
typename _Traits>
1391 operator<<(std::basic_ostream<_CharT, _Traits>&,
1406 template<
typename _RandomNumberEngine1,
size_t __k1,
1407 typename _CharT,
typename _Traits>
1413 void _M_initialize()
1415 for (
size_t __i = 0; __i < __k; ++__i)
1420 _RandomNumberEngine _M_b;
1436 template<
typename _RandomNumberEngine,
size_t __k>
1442 {
return !(__lhs == __rhs); }
1448 typedef linear_congruential_engine<uint_fast32_t, 16807UL, 0UL, 2147483647UL>
1465 typedef mersenne_twister_engine<
1476 typedef mersenne_twister_engine<
1479 0xb5026f5aa96619e9ULL, 29,
1480 0x5555555555555555ULL, 17,
1481 0x71d67fffeda60000ULL, 37,
1482 0xfff7eee000000000ULL, 43,
1485 typedef subtract_with_carry_engine<uint_fast32_t, 24, 10, 24>
1488 typedef subtract_with_carry_engine<uint_fast64_t, 48, 5, 12>
1511 #ifdef _GLIBCXX_USE_RANDOM_TR1
1516 if ((__token !=
"/dev/urandom" && __token !=
"/dev/random")
1517 || !(_M_file = std::fopen(__token.c_str(),
"rb")))
1518 std::__throw_runtime_error(__N(
"random_device::"
1519 "random_device(const std::string&)"));
1523 { std::fclose(_M_file); }
1528 random_device(
const std::string& __token =
"mt19937")
1529 : _M_mt(_M_strtoul(__token)) { }
1532 static unsigned long
1535 unsigned long __ret = 5489UL;
1536 if (__str !=
"mt19937")
1538 const char* __nptr = __str.
c_str();
1540 __ret = std::strtoul(__nptr, &__endptr, 0);
1541 if (*__nptr ==
'\0' || *__endptr !=
'\0')
1542 std::__throw_runtime_error(__N(
"random_device::_M_strtoul"
1543 "(const std::string&)"));
1567 #ifdef _GLIBCXX_USE_RANDOM_TR1
1569 std::fread(reinterpret_cast<void*>(&__ret),
sizeof(
result_type),
1578 random_device(
const random_device&) =
delete;
1579 void operator=(
const random_device&) =
delete;
1583 #ifdef _GLIBCXX_USE_RANDOM_TR1
1609 template<
typename _IntType =
int>
1613 "template argument not an integral type");
1626 : _M_a(__a), _M_b(__b)
1628 _GLIBCXX_DEBUG_ASSERT(_M_a <= _M_b);
1641 {
return __p1._M_a == __p2._M_a && __p1._M_b == __p2._M_b; }
1655 : _M_param(__a, __b)
1673 {
return _M_param.a(); }
1677 {
return _M_param.b(); }
1684 {
return _M_param; }
1692 { _M_param = __param; }
1699 {
return this->a(); }
1706 {
return this->b(); }
1711 template<
typename _UniformRandomNumberGenerator>
1716 template<
typename _UniformRandomNumberGenerator>
1718 operator()(_UniformRandomNumberGenerator& __urng,
1719 const param_type& __p);
1721 param_type _M_param;
1728 template<
typename _IntType>
1738 template<
typename _IntType>
1742 {
return !(__d1 == __d2); }
1754 template<
typename _IntType,
typename _CharT,
typename _Traits>
1756 operator<<(std::basic_ostream<_CharT, _Traits>&,
1768 template<
typename _IntType,
typename _CharT,
typename _Traits>
1781 template<
typename _RealType =
double>
1785 "template argument not a floating point type");
1797 _RealType __b = _RealType(1))
1798 : _M_a(__a), _M_b(__b)
1800 _GLIBCXX_DEBUG_ASSERT(_M_a <= _M_b);
1813 {
return __p1._M_a == __p2._M_a && __p1._M_b == __p2._M_b; }
1829 _RealType __b = _RealType(1))
1830 : _M_param(__a, __b)
1848 {
return _M_param.a(); }
1852 {
return _M_param.b(); }
1859 {
return _M_param; }
1867 { _M_param = __param; }
1874 {
return this->a(); }
1881 {
return this->b(); }
1886 template<
typename _UniformRandomNumberGenerator>
1891 template<
typename _UniformRandomNumberGenerator>
1893 operator()(_UniformRandomNumberGenerator& __urng,
1894 const param_type& __p)
1896 __detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
1898 return (__aurng() * (__p.b() - __p.a())) + __p.a();
1902 param_type _M_param;
1909 template<
typename _IntType>
1919 template<
typename _IntType>
1923 {
return !(__d1 == __d2); }
1935 template<
typename _RealType,
typename _CharT,
typename _Traits>
1937 operator<<(std::basic_ostream<_CharT, _Traits>&,
1949 template<
typename _RealType,
typename _CharT,
typename _Traits>
1971 template<
typename _RealType =
double>
1975 "template argument not a floating point type");
1987 _RealType __stddev = _RealType(1))
1988 : _M_mean(__mean), _M_stddev(__stddev)
1990 _GLIBCXX_DEBUG_ASSERT(_M_stddev > _RealType(0));
1999 {
return _M_stddev; }
2003 {
return (__p1._M_mean == __p2._M_mean
2004 && __p1._M_stddev == __p2._M_stddev); }
2008 _RealType _M_stddev;
2019 : _M_param(__mean, __stddev), _M_saved_available(false)
2024 : _M_param(__p), _M_saved_available(false)
2032 { _M_saved_available =
false; }
2039 {
return _M_param.mean(); }
2046 {
return _M_param.stddev(); }
2053 {
return _M_param; }
2061 { _M_param = __param; }
2080 template<
typename _UniformRandomNumberGenerator>
2085 template<
typename _UniformRandomNumberGenerator>
2087 operator()(_UniformRandomNumberGenerator& __urng,
2088 const param_type& __p);
2095 template<
typename _RealType1>
2110 template<
typename _RealType1,
typename _CharT,
typename _Traits>
2112 operator<<(std::basic_ostream<_CharT, _Traits>&,
2125 template<
typename _RealType1,
typename _CharT,
typename _Traits>
2131 param_type _M_param;
2133 bool _M_saved_available;
2139 template<
typename _RealType>
2143 {
return !(__d1 == __d2); }
2155 template<
typename _RealType =
double>
2159 "template argument not a floating point type");
2171 _RealType __s = _RealType(1))
2172 : _M_m(__m), _M_s(__s)
2185 {
return __p1._M_m == __p2._M_m && __p1._M_s == __p2._M_s; }
2194 _RealType __s = _RealType(1))
2195 : _M_param(__m, __s), _M_nd()
2200 : _M_param(__p), _M_nd()
2215 {
return _M_param.m(); }
2219 {
return _M_param.s(); }
2226 {
return _M_param; }
2234 { _M_param = __param; }
2253 template<
typename _UniformRandomNumberGenerator>
2258 template<
typename _UniformRandomNumberGenerator>
2260 operator()(_UniformRandomNumberGenerator& __urng,
2261 const param_type& __p)
2262 {
return std::exp(__p.s() * _M_nd(__urng) + __p.m()); }
2269 template<
typename _RealType1>
2274 && __d1._M_nd == __d2._M_nd); }
2286 template<
typename _RealType1,
typename _CharT,
typename _Traits>
2288 operator<<(std::basic_ostream<_CharT, _Traits>&,
2301 template<
typename _RealType1,
typename _CharT,
typename _Traits>
2307 param_type _M_param;
2315 template<
typename _RealType>
2319 {
return !(__d1 == __d2); }
2331 template<
typename _RealType =
double>
2335 "template argument not a floating point type");
2347 param_type(_RealType __alpha_val = _RealType(1),
2348 _RealType __beta_val = _RealType(1))
2349 : _M_alpha(__alpha_val), _M_beta(__beta_val)
2351 _GLIBCXX_DEBUG_ASSERT(_M_alpha > _RealType(0));
2357 {
return _M_alpha; }
2364 operator==(
const param_type& __p1,
const param_type& __p2)
2365 {
return (__p1._M_alpha == __p2._M_alpha
2366 && __p1._M_beta == __p2._M_beta); }
2375 _RealType _M_malpha, _M_a2;
2385 _RealType __beta_val = _RealType(1))
2386 : _M_param(__alpha_val, __beta_val), _M_nd()
2391 : _M_param(__p), _M_nd()
2406 {
return _M_param.alpha(); }
2413 {
return _M_param.beta(); }
2420 {
return _M_param; }
2428 { _M_param = __param; }
2447 template<
typename _UniformRandomNumberGenerator>
2452 template<
typename _UniformRandomNumberGenerator>
2454 operator()(_UniformRandomNumberGenerator& __urng,
2455 const param_type& __p);
2462 template<
typename _RealType1>
2467 && __d1._M_nd == __d2._M_nd); }
2479 template<
typename _RealType1,
typename _CharT,
typename _Traits>
2481 operator<<(std::basic_ostream<_CharT, _Traits>&,
2493 template<
typename _RealType1,
typename _CharT,
typename _Traits>
2499 param_type _M_param;
2507 template<
typename _RealType>
2511 {
return !(__d1 == __d2); }
2520 template<
typename _RealType =
double>
2524 "template argument not a floating point type");
2545 {
return __p1._M_n == __p2._M_n; }
2553 : _M_param(__n), _M_gd(__n / 2)
2558 : _M_param(__p), _M_gd(__p.n() / 2)
2573 {
return _M_param.n(); }
2580 {
return _M_param; }
2588 { _M_param = __param; }
2607 template<
typename _UniformRandomNumberGenerator>
2610 {
return 2 * _M_gd(__urng); }
2612 template<
typename _UniformRandomNumberGenerator>
2614 operator()(_UniformRandomNumberGenerator& __urng,
2615 const param_type& __p)
2619 return 2 * _M_gd(__urng, param_type(__p.n() / 2));
2627 template<
typename _RealType1>
2631 {
return __d1.
param() == __d2.
param() && __d1._M_gd == __d2._M_gd; }
2643 template<
typename _RealType1,
typename _CharT,
typename _Traits>
2645 operator<<(std::basic_ostream<_CharT, _Traits>&,
2658 template<
typename _RealType1,
typename _CharT,
typename _Traits>
2664 param_type _M_param;
2672 template<
typename _RealType>
2676 {
return !(__d1 == __d2); }
2685 template<
typename _RealType =
double>
2689 "template argument not a floating point type");
2701 _RealType __b = _RealType(1))
2702 : _M_a(__a), _M_b(__b)
2715 {
return __p1._M_a == __p2._M_a && __p1._M_b == __p2._M_b; }
2724 _RealType __b = _RealType(1))
2725 : _M_param(__a, __b)
2745 {
return _M_param.a(); }
2749 {
return _M_param.b(); }
2756 {
return _M_param; }
2764 { _M_param = __param; }
2783 template<
typename _UniformRandomNumberGenerator>
2788 template<
typename _UniformRandomNumberGenerator>
2790 operator()(_UniformRandomNumberGenerator& __urng,
2791 const param_type& __p);
2794 param_type _M_param;
2801 template<
typename _RealType>
2811 template<
typename _RealType>
2815 {
return !(__d1 == __d2); }
2827 template<
typename _RealType,
typename _CharT,
typename _Traits>
2829 operator<<(std::basic_ostream<_CharT, _Traits>&,
2842 template<
typename _RealType,
typename _CharT,
typename _Traits>
2858 template<
typename _RealType =
double>
2862 "template argument not a floating point type");
2874 _RealType __n = _RealType(1))
2875 : _M_m(__m), _M_n(__n)
2888 {
return __p1._M_m == __p2._M_m && __p1._M_n == __p2._M_n; }
2897 _RealType __n = _RealType(1))
2898 : _M_param(__m, __n), _M_gd_x(__m / 2), _M_gd_y(__n / 2)
2903 : _M_param(__p), _M_gd_x(__p.m() / 2), _M_gd_y(__p.n() / 2)
2921 {
return _M_param.m(); }
2925 {
return _M_param.n(); }
2932 {
return _M_param; }
2940 { _M_param = __param; }
2959 template<
typename _UniformRandomNumberGenerator>
2962 {
return (_M_gd_x(__urng) * n()) / (_M_gd_y(__urng) * m()); }
2964 template<
typename _UniformRandomNumberGenerator>
2966 operator()(_UniformRandomNumberGenerator& __urng,
2967 const param_type& __p)
2971 return ((_M_gd_x(__urng, param_type(__p.m() / 2)) * n())
2972 / (_M_gd_y(__urng, param_type(__p.n() / 2)) * m()));
2980 template<
typename _RealType1>
2985 && __d1._M_gd_x == __d2._M_gd_x
2986 && __d1._M_gd_y == __d2._M_gd_y); }
2998 template<
typename _RealType1,
typename _CharT,
typename _Traits>
3000 operator<<(std::basic_ostream<_CharT, _Traits>&,
3013 template<
typename _RealType1,
typename _CharT,
typename _Traits>
3019 param_type _M_param;
3027 template<
typename _RealType>
3031 {
return !(__d1 == __d2); }
3042 template<
typename _RealType =
double>
3046 "template argument not a floating point type");
3057 param_type(_RealType __n = _RealType(1))
3066 operator==(
const param_type& __p1,
const param_type& __p2)
3067 {
return __p1._M_n == __p2._M_n; }
3075 : _M_param(__n), _M_nd(), _M_gd(__n / 2, 2)
3080 : _M_param(__p), _M_nd(), _M_gd(__p.n() / 2, 2)
3098 {
return _M_param.n(); }
3105 {
return _M_param; }
3113 { _M_param = __param; }
3132 template<
typename _UniformRandomNumberGenerator>
3135 {
return _M_nd(__urng) *
std::sqrt(n() / _M_gd(__urng)); }
3137 template<
typename _UniformRandomNumberGenerator>
3139 operator()(_UniformRandomNumberGenerator& __urng,
3140 const param_type& __p)
3145 const result_type __g = _M_gd(__urng, param_type(__p.n() / 2, 2));
3146 return _M_nd(__urng) *
std::sqrt(__p.n() / __g);
3154 template<
typename _RealType1>
3159 && __d1._M_nd == __d2._M_nd && __d1._M_gd == __d2._M_gd); }
3171 template<
typename _RealType1,
typename _CharT,
typename _Traits>
3173 operator<<(std::basic_ostream<_CharT, _Traits>&,
3186 template<
typename _RealType1,
typename _CharT,
typename _Traits>
3192 param_type _M_param;
3201 template<
typename _RealType>
3205 {
return !(__d1 == __d2); }
3233 param_type(
double __p = 0.5)
3236 _GLIBCXX_DEBUG_ASSERT((_M_p >= 0.0) && (_M_p <= 1.0));
3244 operator==(
const param_type& __p1,
const param_type& __p2)
3245 {
return __p1._M_p == __p2._M_p; }
3281 {
return _M_param.p(); }
3288 {
return _M_param; }
3296 { _M_param = __param; }
3315 template<
typename _UniformRandomNumberGenerator>
3320 template<
typename _UniformRandomNumberGenerator>
3322 operator()(_UniformRandomNumberGenerator& __urng,
3323 const param_type& __p)
3325 __detail::_Adaptor<_UniformRandomNumberGenerator, double>
3327 if ((__aurng() - __aurng.min())
3328 < __p.p() * (__aurng.max() - __aurng.min()))
3334 param_type _M_param;
3353 {
return !(__d1 == __d2); }
3365 template<
typename _CharT,
typename _Traits>
3367 operator<<(std::basic_ostream<_CharT, _Traits>&,
3379 template<
typename _CharT,
typename _Traits>
3398 template<
typename _IntType =
int>
3402 "template argument not an integral type");
3414 param_type(_IntType __t = _IntType(1),
double __p = 0.5)
3415 : _M_t(__t), _M_p(__p)
3417 _GLIBCXX_DEBUG_ASSERT((_M_t >= _IntType(0))
3432 operator==(
const param_type& __p1,
const param_type& __p2)
3433 {
return __p1._M_t == __p2._M_t && __p1._M_p == __p2._M_p; }
3443 #if _GLIBCXX_USE_C99_MATH_TR1
3444 double _M_d1, _M_d2, _M_s1, _M_s2, _M_c,
3445 _M_a1, _M_a123, _M_s, _M_lf, _M_lp1p;
3454 : _M_param(__t, __p), _M_nd()
3459 : _M_param(__p), _M_nd()
3474 {
return _M_param.t(); }
3481 {
return _M_param.p(); }
3488 {
return _M_param; }
3496 { _M_param = __param; }
3510 {
return _M_param.t(); }
3515 template<
typename _UniformRandomNumberGenerator>
3520 template<
typename _UniformRandomNumberGenerator>
3522 operator()(_UniformRandomNumberGenerator& __urng,
3523 const param_type& __p);
3530 template<
typename _IntType1>
3534 #ifdef _GLIBCXX_USE_C99_MATH_TR1
3535 {
return __d1.
param() == __d2.
param() && __d1._M_nd == __d2._M_nd; }
3550 template<
typename _IntType1,
3551 typename _CharT,
typename _Traits>
3553 operator<<(std::basic_ostream<_CharT, _Traits>&,
3566 template<
typename _IntType1,
3567 typename _CharT,
typename _Traits>
3573 template<
typename _UniformRandomNumberGenerator>
3575 _M_waiting(_UniformRandomNumberGenerator& __urng, _IntType __t);
3577 param_type _M_param;
3586 template<
typename _IntType>
3590 {
return !(__d1 == __d2); }
3600 template<
typename _IntType =
int>
3604 "template argument not an integral type");
3616 param_type(
double __p = 0.5)
3619 _GLIBCXX_DEBUG_ASSERT((_M_p > 0.0)
3629 operator==(
const param_type& __p1,
const param_type& __p2)
3630 {
return __p1._M_p == __p2._M_p; }
3635 { _M_log_1_p =
std::log(1.0 - _M_p); }
3666 {
return _M_param.p(); }
3673 {
return _M_param; }
3681 { _M_param = __param; }
3700 template<
typename _UniformRandomNumberGenerator>
3705 template<
typename _UniformRandomNumberGenerator>
3707 operator()(_UniformRandomNumberGenerator& __urng,
3708 const param_type& __p);
3711 param_type _M_param;
3718 template<
typename _IntType>
3728 template<
typename _IntType>
3732 {
return !(__d1 == __d2); }
3744 template<
typename _IntType,
3745 typename _CharT,
typename _Traits>
3747 operator<<(std::basic_ostream<_CharT, _Traits>&,
3759 template<
typename _IntType,
3760 typename _CharT,
typename _Traits>
3773 template<
typename _IntType =
int>
3777 "template argument not an integral type");
3788 param_type(_IntType __k = 1,
double __p = 0.5)
3789 : _M_k(__k), _M_p(__p)
3791 _GLIBCXX_DEBUG_ASSERT((_M_k > 0) && (_M_p > 0.0) && (_M_p <= 1.0));
3803 operator==(
const param_type& __p1,
const param_type& __p2)
3804 {
return __p1._M_k == __p2._M_k && __p1._M_p == __p2._M_p; }
3813 : _M_param(__k, __p), _M_gd(__k, (1.0 - __p) / __p)
3818 : _M_param(__p), _M_gd(__p.
k(), (1.0 - __p.
p()) / __p.
p())
3833 {
return _M_param.k(); }
3840 {
return _M_param.p(); }
3847 {
return _M_param; }
3855 { _M_param = __param; }
3874 template<
typename _UniformRandomNumberGenerator>
3876 operator()(_UniformRandomNumberGenerator& __urng);
3878 template<
typename _UniformRandomNumberGenerator>
3880 operator()(_UniformRandomNumberGenerator& __urng,
3881 const param_type& __p);
3888 template<
typename _IntType1>
3892 {
return __d1.
param() == __d2.
param() && __d1._M_gd == __d2._M_gd; }
3905 template<
typename _IntType1,
typename _CharT,
typename _Traits>
3907 operator<<(std::basic_ostream<_CharT, _Traits>&,
3920 template<
typename _IntType1,
typename _CharT,
typename _Traits>
3926 param_type _M_param;
3934 template<
typename _IntType>
3938 {
return !(__d1 == __d2); }
3956 template<
typename _IntType =
int>
3960 "template argument not an integral type");
3972 param_type(
double __mean = 1.0)
3975 _GLIBCXX_DEBUG_ASSERT(_M_mean > 0.0);
3984 operator==(
const param_type& __p1,
const param_type& __p2)
3985 {
return __p1._M_mean == __p2._M_mean; }
3995 #if _GLIBCXX_USE_C99_MATH_TR1
3996 double _M_lfm, _M_sm, _M_d, _M_scx, _M_1cx, _M_c2b, _M_cb;
4003 : _M_param(__mean), _M_nd()
4008 : _M_param(__p), _M_nd()
4023 {
return _M_param.mean(); }
4030 {
return _M_param; }
4038 { _M_param = __param; }
4057 template<
typename _UniformRandomNumberGenerator>
4062 template<
typename _UniformRandomNumberGenerator>
4064 operator()(_UniformRandomNumberGenerator& __urng,
4065 const param_type& __p);
4072 template<
typename _IntType1>
4076 #ifdef _GLIBCXX_USE_C99_MATH_TR1
4077 {
return __d1.
param() == __d2.
param() && __d1._M_nd == __d2._M_nd; }
4092 template<
typename _IntType1,
typename _CharT,
typename _Traits>
4094 operator<<(std::basic_ostream<_CharT, _Traits>&,
4107 template<
typename _IntType1,
typename _CharT,
typename _Traits>
4113 param_type _M_param;
4122 template<
typename _IntType>
4126 {
return !(__d1 == __d2); }
4144 template<
typename _RealType =
double>
4148 "template argument not a floating point type");
4159 param_type(_RealType __lambda = _RealType(1))
4160 : _M_lambda(__lambda)
4162 _GLIBCXX_DEBUG_ASSERT(_M_lambda > _RealType(0));
4167 {
return _M_lambda; }
4170 operator==(
const param_type& __p1,
const param_type& __p2)
4171 {
return __p1._M_lambda == __p2._M_lambda; }
4174 _RealType _M_lambda;
4184 : _M_param(__lambda)
4205 {
return _M_param.lambda(); }
4212 {
return _M_param; }
4220 { _M_param = __param; }
4239 template<
typename _UniformRandomNumberGenerator>
4244 template<
typename _UniformRandomNumberGenerator>
4246 operator()(_UniformRandomNumberGenerator& __urng,
4247 const param_type& __p)
4249 __detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
4251 return -
std::log(__aurng()) / __p.lambda();
4255 param_type _M_param;
4262 template<
typename _RealType>
4272 template<
typename _RealType>
4276 {
return !(__d1 == __d2); }
4288 template<
typename _RealType,
typename _CharT,
typename _Traits>
4290 operator<<(std::basic_ostream<_CharT, _Traits>&,
4303 template<
typename _RealType,
typename _CharT,
typename _Traits>
4318 template<
typename _RealType =
double>
4322 "template argument not a floating point type");
4333 param_type(_RealType __a = _RealType(1),
4334 _RealType __b = _RealType(1))
4335 : _M_a(__a), _M_b(__b)
4347 operator==(
const param_type& __p1,
const param_type& __p2)
4348 {
return __p1._M_a == __p2._M_a && __p1._M_b == __p2._M_b; }
4357 _RealType __b = _RealType(1))
4358 : _M_param(__a, __b)
4378 {
return _M_param.a(); }
4385 {
return _M_param.b(); }
4392 {
return _M_param; }
4400 { _M_param = __param; }
4419 template<
typename _UniformRandomNumberGenerator>
4424 template<
typename _UniformRandomNumberGenerator>
4426 operator()(_UniformRandomNumberGenerator& __urng,
4427 const param_type& __p);
4430 param_type _M_param;
4437 template<
typename _RealType>
4447 template<
typename _RealType>
4451 {
return !(__d1 == __d2); }
4463 template<
typename _RealType,
typename _CharT,
typename _Traits>
4465 operator<<(std::basic_ostream<_CharT, _Traits>&,
4478 template<
typename _RealType,
typename _CharT,
typename _Traits>
4493 template<
typename _RealType =
double>
4497 "template argument not a floating point type");
4508 param_type(_RealType __a = _RealType(0),
4509 _RealType __b = _RealType(1))
4510 : _M_a(__a), _M_b(__b)
4522 operator==(
const param_type& __p1,
const param_type& __p2)
4523 {
return __p1._M_a == __p2._M_a && __p1._M_b == __p2._M_b; }
4532 _RealType __b = _RealType(1))
4533 : _M_param(__a, __b)
4553 {
return _M_param.a(); }
4560 {
return _M_param.b(); }
4567 {
return _M_param; }
4575 { _M_param = __param; }
4594 template<
typename _UniformRandomNumberGenerator>
4599 template<
typename _UniformRandomNumberGenerator>
4601 operator()(_UniformRandomNumberGenerator& __urng,
4602 const param_type& __p);
4605 param_type _M_param;
4612 template<
typename _RealType>
4622 template<
typename _RealType>
4626 {
return !(__d1 == __d2); }
4638 template<
typename _RealType,
typename _CharT,
typename _Traits>
4640 operator<<(std::basic_ostream<_CharT, _Traits>&,
4653 template<
typename _RealType,
typename _CharT,
typename _Traits>
4665 template<
typename _IntType =
int>
4669 "template argument not an integral type");
4681 : _M_prob(), _M_cp()
4684 template<
typename _InputIterator>
4685 param_type(_InputIterator __wbegin,
4686 _InputIterator __wend)
4687 : _M_prob(__wbegin, __wend), _M_cp()
4688 { _M_initialize(); }
4691 : _M_prob(__wil.begin(), __wil.end()), _M_cp()
4692 { _M_initialize(); }
4694 template<
typename _Func>
4695 param_type(
size_t __nw,
double __xmin,
double __xmax,
4699 param_type(
const param_type&) =
default;
4700 param_type& operator=(
const param_type&) =
default;
4703 probabilities()
const
4707 operator==(
const param_type& __p1,
const param_type& __p2)
4708 {
return __p1._M_prob == __p2._M_prob; }
4722 template<
typename _InputIterator>
4724 _InputIterator __wend)
4725 : _M_param(__wbegin, __wend)
4728 discrete_distribution(initializer_list<double> __wl)
4732 template<
typename _Func>
4733 discrete_distribution(
size_t __nw,
double __xmin,
double __xmax,
4735 : _M_param(__nw, __xmin, __xmax, __fw)
4739 discrete_distribution(
const param_type& __p)
4756 return _M_param._M_prob.
empty()
4765 {
return _M_param; }
4773 { _M_param = __param; }
4788 return _M_param._M_prob.
empty()
4795 template<
typename _UniformRandomNumberGenerator>
4800 template<
typename _UniformRandomNumberGenerator>
4802 operator()(_UniformRandomNumberGenerator& __urng,
4803 const param_type& __p);
4815 template<
typename _IntType1,
typename _CharT,
typename _Traits>
4817 operator<<(std::basic_ostream<_CharT, _Traits>&,
4831 template<
typename _IntType1,
typename _CharT,
typename _Traits>
4837 param_type _M_param;
4844 template<
typename _IntType>
4854 template<
typename _IntType>
4858 {
return !(__d1 == __d2); }
4867 template<
typename _RealType =
double>
4871 "template argument not a floating point type");
4883 : _M_int(), _M_den(), _M_cp()
4886 template<
typename _InputIteratorB,
typename _InputIteratorW>
4887 param_type(_InputIteratorB __bfirst,
4888 _InputIteratorB __bend,
4889 _InputIteratorW __wbegin);
4891 template<
typename _Func>
4894 template<
typename _Func>
4895 param_type(
size_t __nw, _RealType __xmin, _RealType __xmax,
4899 param_type(
const param_type&) =
default;
4900 param_type& operator=(
const param_type&) =
default;
4908 __tmp[1] = _RealType(1);
4920 operator==(
const param_type& __p1,
const param_type& __p2)
4921 {
return __p1._M_int == __p2._M_int && __p1._M_den == __p2._M_den; }
4937 template<
typename _InputIteratorB,
typename _InputIteratorW>
4939 _InputIteratorB __bend,
4940 _InputIteratorW __wbegin)
4941 : _M_param(__bfirst, __bend, __wbegin)
4944 template<
typename _Func>
4945 piecewise_constant_distribution(initializer_list<_RealType> __bl,
4947 : _M_param(__bl, __fw)
4950 template<
typename _Func>
4951 piecewise_constant_distribution(
size_t __nw,
4952 _RealType __xmin, _RealType __xmax,
4954 : _M_param(__nw, __xmin, __xmax, __fw)
4958 piecewise_constant_distribution(
const param_type& __p)
4975 if (_M_param._M_int.
empty())
4978 __tmp[1] = _RealType(1);
4982 return _M_param._M_int;
4991 return _M_param._M_den.
empty()
5000 {
return _M_param; }
5008 { _M_param = __param; }
5016 return _M_param._M_int.
empty()
5026 return _M_param._M_int.
empty()
5033 template<
typename _UniformRandomNumberGenerator>
5038 template<
typename _UniformRandomNumberGenerator>
5040 operator()(_UniformRandomNumberGenerator& __urng,
5041 const param_type& __p);
5054 template<
typename _RealType1,
typename _CharT,
typename _Traits>
5056 operator<<(std::basic_ostream<_CharT, _Traits>&,
5070 template<
typename _RealType1,
typename _CharT,
typename _Traits>
5076 param_type _M_param;
5083 template<
typename _RealType>
5093 template<
typename _RealType>
5097 {
return !(__d1 == __d2); }
5106 template<
typename _RealType =
double>
5110 "template argument not a floating point type");
5122 : _M_int(), _M_den(), _M_cp(), _M_m()
5125 template<
typename _InputIteratorB,
typename _InputIteratorW>
5126 param_type(_InputIteratorB __bfirst,
5127 _InputIteratorB __bend,
5128 _InputIteratorW __wbegin);
5130 template<
typename _Func>
5133 template<
typename _Func>
5134 param_type(
size_t __nw, _RealType __xmin, _RealType __xmax,
5138 param_type(
const param_type&) =
default;
5139 param_type& operator=(
const param_type&) =
default;
5147 __tmp[1] = _RealType(1);
5159 operator==(
const param_type& __p1,
const param_type& __p2)
5160 {
return (__p1._M_int == __p2._M_int
5161 && __p1._M_den == __p2._M_den); }
5178 template<
typename _InputIteratorB,
typename _InputIteratorW>
5180 _InputIteratorB __bend,
5181 _InputIteratorW __wbegin)
5182 : _M_param(__bfirst, __bend, __wbegin)
5185 template<
typename _Func>
5186 piecewise_linear_distribution(initializer_list<_RealType> __bl,
5188 : _M_param(__bl, __fw)
5191 template<
typename _Func>
5192 piecewise_linear_distribution(
size_t __nw,
5193 _RealType __xmin, _RealType __xmax,
5195 : _M_param(__nw, __xmin, __xmax, __fw)
5199 piecewise_linear_distribution(
const param_type& __p)
5216 if (_M_param._M_int.
empty())
5219 __tmp[1] = _RealType(1);
5223 return _M_param._M_int;
5233 return _M_param._M_den.
empty()
5242 {
return _M_param; }
5250 { _M_param = __param; }
5258 return _M_param._M_int.
empty()
5268 return _M_param._M_int.
empty()
5275 template<
typename _UniformRandomNumberGenerator>
5280 template<
typename _UniformRandomNumberGenerator>
5282 operator()(_UniformRandomNumberGenerator& __urng,
5283 const param_type& __p);
5296 template<
typename _RealType1,
typename _CharT,
typename _Traits>
5298 operator<<(std::basic_ostream<_CharT, _Traits>&,
5312 template<
typename _RealType1,
typename _CharT,
typename _Traits>
5318 param_type _M_param;
5325 template<
typename _RealType>
5335 template<
typename _RealType>
5339 {
return !(__d1 == __d2); }
5368 template<
typename _IntType>
5371 template<
typename _InputIterator>
5372 seed_seq(_InputIterator __begin, _InputIterator __end);
5375 template<
typename _RandomAccessIterator>
5377 generate(_RandomAccessIterator __begin, _RandomAccessIterator __end);
5381 {
return _M_v.
size(); }
5383 template<
typename OutputIterator>
5385 param(OutputIterator __dest)
const
5386 { std::copy(_M_v.
begin(), _M_v.
end(), __dest); }
5397 _GLIBCXX_END_NAMESPACE_VERSION