38namespace std _GLIBCXX_VISIBILITY(default)
40_GLIBCXX_BEGIN_NAMESPACE_VERSION
59 template<
typename _RealType,
size_t __bits,
60 typename _UniformRandomNumberGenerator>
68#pragma GCC diagnostic push
69#pragma GCC diagnostic ignored "-Wc++17-extensions"
71 template<
typename _UIntType,
size_t __w,
72 bool = __w < static_cast<size_t>
75 {
static constexpr _UIntType __value = 0; };
77 template<
typename _UIntType,
size_t __w>
78 struct _Shift<_UIntType, __w, true>
79 {
static constexpr _UIntType __value = _UIntType(1) << __w; };
82 int __which = ((__s <= __CHAR_BIT__ *
sizeof (int))
83 + (__s <= __CHAR_BIT__ *
sizeof (long))
84 + (__s <= __CHAR_BIT__ *
sizeof (
long long))
87 struct _Select_uint_least_t
89 static_assert(__which < 0,
90 "sorry, would be too much trouble for a slow result");
94 struct _Select_uint_least_t<__s, 4>
95 {
using type =
unsigned int; };
98 struct _Select_uint_least_t<__s, 3>
99 {
using type =
unsigned long; };
102 struct _Select_uint_least_t<__s, 2>
103 {
using type =
unsigned long long; };
105#if __SIZEOF_INT128__ > __SIZEOF_LONG_LONG__
107 struct _Select_uint_least_t<__s, 1>
108 { __extension__
using type =
unsigned __int128; };
109#elif __has_builtin(__builtin_add_overflow) \
110 && __has_builtin(__builtin_sub_overflow) \
111 && defined __UINT64_TYPE__
113 struct _Select_uint_least_t<__s, 1>
120 type(uint64_t __a) noexcept : _M_lo(__a), _M_hi(0) { }
124 operator*(type __l, uint64_t __x)
noexcept
130 constexpr uint64_t __mask = 0xffffffff;
131 uint64_t __ll[2] = { __l._M_lo >> 32, __l._M_lo & __mask };
132 uint64_t __xx[2] = { __x >> 32, __x & __mask };
133 uint64_t __l0x0 = __ll[0] * __xx[0];
134 uint64_t __l0x1 = __ll[0] * __xx[1];
135 uint64_t __l1x0 = __ll[1] * __xx[0];
136 uint64_t __l1x1 = __ll[1] * __xx[1];
140 = (__l0x1 & __mask) + (__l1x0 & __mask) + (__l1x1 >> 32);
141 __l._M_hi = __l0x0 + (__l0x1 >> 32) + (__l1x0 >> 32) + (__mid >> 32);
142 __l._M_lo = (__mid << 32) + (__l1x1 & __mask);
147 operator+(type __l, uint64_t __c)
noexcept
149 __l._M_hi += __builtin_add_overflow(__l._M_lo, __c, &__l._M_lo);
154 operator%(type __l, uint64_t __m)
noexcept
156 if (__builtin_expect(__l._M_hi == 0, 0))
162 int __shift = __builtin_clzll(__m) + 64
163 - __builtin_clzll(__l._M_hi);
167 __x._M_hi = __m << (__shift - 64);
172 __x._M_hi = __m >> (64 - __shift);
173 __x._M_lo = __m << __shift;
176 while (__l._M_hi != 0 || __l._M_lo >= __m)
180 __l._M_hi -= __x._M_hi;
181 __l._M_hi -= __builtin_sub_overflow(__l._M_lo, __x._M_lo,
184 __x._M_lo = (__x._M_lo >> 1) | (__x._M_hi << 63);
191 explicit operator uint64_t() const noexcept
194 friend bool operator<(
const type& __l,
const type& __r)
noexcept
196 if (__l._M_hi < __r._M_hi)
198 else if (__l._M_hi == __r._M_hi)
199 return __l._M_lo < __r._M_lo;
204 friend bool operator<=(
const type& __l,
const type& __r)
noexcept
205 {
return !(__r < __l); }
214 template<
typename _Tp, _Tp __m, _Tp __a, _Tp __c,
215 bool __big_enough = (!(__m & (__m - 1))
216 || (_Tp(-1) - __c) / __a >= __m - 1),
217 bool __schrage_ok = __m % __a < __m / __a>
224 =
typename _Select_uint_least_t<
std::__lg(__a)
226 return static_cast<_Tp
>((_Tp2(__a) * __x + __c) % __m);
231 template<
typename _Tp, _Tp __m, _Tp __a, _Tp __c>
232 struct _Mod<_Tp, __m, __a, __c, false, true>
241 template<
typename _Tp, _Tp __m, _Tp __a, _Tp __c,
bool __s>
242 struct _Mod<_Tp, __m, __a, __c, true, __s>
247 _Tp __res = __a * __x + __c;
254 template<
typename _Tp, _Tp __m, _Tp __a = 1, _Tp __c = 0>
258 if constexpr (__a == 0)
261 return _Mod<_Tp, __m, __a, __c>::__calc(__x);
268 template<
typename _Engine,
typename _DInputType>
271 static_assert(std::is_floating_point<_DInputType>::value,
272 "template argument must be a floating point type");
275 _Adaptor(_Engine& __g)
280 {
return _DInputType(0); }
284 {
return _DInputType(1); }
308 template<
typename _Sseq>
309 using __seed_seq_generate_t =
decltype(
313 template<
typename _Sseq,
typename _Engine,
typename _Res,
314 typename _GenerateCheck = __seed_seq_generate_t<_Sseq>>
315 using _If_seed_seq_for = _Require<
316 __not_<is_same<__remove_cvref_t<_Sseq>, _Engine>>,
317 is_unsigned<typename _Sseq::result_type>,
318 __not_<is_convertible<_Sseq, _Res>>
321#pragma GCC diagnostic pop
366 template<
typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
370 "result_type must be an unsigned integral type");
371 static_assert(__m == 0u || (__a < __m && __c < __m),
372 "template argument substituting __m out of bounds");
374 template<
typename _Sseq>
415 template<
typename _Sseq,
typename = _If_seed_seq<_Sseq>>
436 template<
typename _Sseq>
448 {
return __c == 0u ? 1u : 0u; }
461 discard(
unsigned long long __z)
463 for (; __z != 0ULL; --__z)
473 _M_x = __detail::__mod<_UIntType, __m, __a, __c>(_M_x);
491 {
return __lhs._M_x == __rhs._M_x; }
501 template<
typename _UIntType1, _UIntType1 __a1, _UIntType1 __c1,
502 _UIntType1 __m1,
typename _CharT,
typename _Traits>
506 __a1, __c1, __m1>& __lcr);
521 template<
typename _UIntType1, _UIntType1 __a1, _UIntType1 __c1,
522 _UIntType1 __m1,
typename _CharT,
typename _Traits>
532#if __cpp_impl_three_way_comparison < 201907L
544 template<
typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
550 {
return !(__lhs == __rhs); }
584 template<
typename _UIntType,
size_t __w,
585 size_t __n,
size_t __m,
size_t __r,
586 _UIntType __a,
size_t __u, _UIntType __d,
size_t __s,
587 _UIntType __b,
size_t __t,
588 _UIntType __c,
size_t __l, _UIntType __f>
589 class mersenne_twister_engine
592 "result_type must be an unsigned integral type");
593 static_assert(1u <= __m && __m <= __n,
594 "template argument substituting __m out of bounds");
595 static_assert(__r <= __w,
"template argument substituting "
597 static_assert(__u <= __w,
"template argument substituting "
599 static_assert(__s <= __w,
"template argument substituting "
601 static_assert(__t <= __w,
"template argument substituting "
603 static_assert(__l <= __w,
"template argument substituting "
605 static_assert(__w <= std::numeric_limits<_UIntType>::digits,
606 "template argument substituting __w out of bound");
607 static_assert(__a <= (__detail::_Shift<_UIntType, __w>::__value - 1),
608 "template argument substituting __a out of bound");
609 static_assert(__b <= (__detail::_Shift<_UIntType, __w>::__value - 1),
610 "template argument substituting __b out of bound");
611 static_assert(__c <= (__detail::_Shift<_UIntType, __w>::__value - 1),
612 "template argument substituting __c out of bound");
613 static_assert(__d <= (__detail::_Shift<_UIntType, __w>::__value - 1),
614 "template argument substituting __d out of bound");
615 static_assert(__f <= (__detail::_Shift<_UIntType, __w>::__value - 1),
616 "template argument substituting __f out of bound");
618 template<
typename _Sseq>
620 = __detail::_If_seed_seq_for<_Sseq, mersenne_twister_engine,
628 static constexpr size_t word_size = __w;
629 static constexpr size_t state_size = __n;
630 static constexpr size_t shift_size = __m;
631 static constexpr size_t mask_bits = __r;
633 static constexpr size_t tempering_u = __u;
635 static constexpr size_t tempering_s = __s;
637 static constexpr size_t tempering_t = __t;
639 static constexpr size_t tempering_l = __l;
640 static constexpr result_type initialization_multiplier = __f;
645 mersenne_twister_engine() : mersenne_twister_engine(default_seed) { }
657 template<
typename _Sseq,
typename = _If_seed_seq<_Sseq>>
659 mersenne_twister_engine(_Sseq& __q)
663 seed(result_type __sd = default_seed);
665 template<
typename _Sseq>
681 {
return __detail::_Shift<_UIntType, __w>::__value - 1; }
687 discard(
unsigned long long __z);
705 operator==(
const mersenne_twister_engine& __lhs,
706 const mersenne_twister_engine& __rhs)
707 {
return (std::equal(__lhs._M_x, __lhs._M_x + state_size, __rhs._M_x)
708 && __lhs._M_p == __rhs._M_p); }
722 template<
typename _UIntType1,
723 size_t __w1,
size_t __n1,
724 size_t __m1,
size_t __r1,
725 _UIntType1 __a1,
size_t __u1,
726 _UIntType1 __d1,
size_t __s1,
727 _UIntType1 __b1,
size_t __t1,
728 _UIntType1 __c1,
size_t __l1, _UIntType1 __f1,
729 typename _CharT,
typename _Traits>
733 __m1, __r1, __a1, __u1, __d1, __s1, __b1, __t1, __c1,
748 template<
typename _UIntType1,
749 size_t __w1,
size_t __n1,
750 size_t __m1,
size_t __r1,
751 _UIntType1 __a1,
size_t __u1,
752 _UIntType1 __d1,
size_t __s1,
753 _UIntType1 __b1,
size_t __t1,
754 _UIntType1 __c1,
size_t __l1, _UIntType1 __f1,
755 typename _CharT,
typename _Traits>
759 __r1, __a1, __u1, __d1, __s1, __b1, __t1, __c1,
765 _UIntType _M_x[state_size];
769#if __cpp_impl_three_way_comparison < 201907L
782 template<
typename _UIntType,
size_t __w,
783 size_t __n,
size_t __m,
size_t __r,
784 _UIntType __a,
size_t __u, _UIntType __d,
size_t __s,
785 _UIntType __b,
size_t __t,
786 _UIntType __c,
size_t __l, _UIntType __f>
789 __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>& __lhs,
791 __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>& __rhs)
792 {
return !(__lhs == __rhs); }
813 template<
typename _UIntType,
size_t __w,
size_t __s,
size_t __r>
814 class subtract_with_carry_engine
817 "result_type must be an unsigned integral type");
818 static_assert(0u < __s && __s < __r,
820 static_assert(0u < __w && __w <= std::numeric_limits<_UIntType>::digits,
821 "template argument substituting __w out of bounds");
823 template<
typename _Sseq>
825 = __detail::_If_seed_seq_for<_Sseq, subtract_with_carry_engine,
833 static constexpr size_t word_size = __w;
834 static constexpr size_t short_lag = __s;
835 static constexpr size_t long_lag = __r;
836 static constexpr uint_least32_t default_seed = 19780503u;
838 subtract_with_carry_engine() : subtract_with_carry_engine(0u)
855 template<
typename _Sseq,
typename = _If_seed_seq<_Sseq>>
857 subtract_with_carry_engine(_Sseq& __q)
879 template<
typename _Sseq>
897 {
return __detail::_Shift<_UIntType, __w>::__value - 1; }
903 discard(
unsigned long long __z)
905 for (; __z != 0ULL; --__z)
928 operator==(
const subtract_with_carry_engine& __lhs,
929 const subtract_with_carry_engine& __rhs)
930 {
return (std::equal(__lhs._M_x, __lhs._M_x + long_lag, __rhs._M_x)
931 && __lhs._M_carry == __rhs._M_carry
932 && __lhs._M_p == __rhs._M_p); }
946 template<
typename _UIntType1,
size_t __w1,
size_t __s1,
size_t __r1,
947 typename _CharT,
typename _Traits>
965 template<
typename _UIntType1,
size_t __w1,
size_t __s1,
size_t __r1,
966 typename _CharT,
typename _Traits>
974 _UIntType _M_x[long_lag];
979#if __cpp_impl_three_way_comparison < 201907L
992 template<
typename _UIntType,
size_t __w,
size_t __s,
size_t __r>
998 {
return !(__lhs == __rhs); }
1010 template<
typename _RandomNumberEngine,
size_t __p,
size_t __r>
1013 static_assert(1 <= __r && __r <= __p,
1014 "template argument substituting __r out of bounds");
1020 template<
typename _Sseq>
1026 static constexpr size_t block_size = __p;
1027 static constexpr size_t used_block = __r;
1035 : _M_b(), _M_n(0) { }
1045 : _M_b(__rng), _M_n(0) { }
1055 : _M_b(
std::
move(__rng)), _M_n(0) { }
1065 : _M_b(__s), _M_n(0) { }
1072 template<
typename _Sseq,
typename = _If_seed_seq<_Sseq>>
1075 : _M_b(__q), _M_n(0)
1105 template<
typename _Sseq>
1117 const _RandomNumberEngine&
1118 base() const noexcept
1126 {
return _RandomNumberEngine::min(); }
1133 {
return _RandomNumberEngine::max(); }
1139 discard(
unsigned long long __z)
1141 for (; __z != 0ULL; --__z)
1165 {
return __lhs._M_b == __rhs._M_b && __lhs._M_n == __rhs._M_n; }
1178 template<
typename _RandomNumberEngine1,
size_t __p1,
size_t __r1,
1179 typename _CharT,
typename _Traits>
1196 template<
typename _RandomNumberEngine1,
size_t __p1,
size_t __r1,
1197 typename _CharT,
typename _Traits>
1204 _RandomNumberEngine _M_b;
1208#if __cpp_impl_three_way_comparison < 201907L
1220 template<
typename _RandomNumberEngine,
size_t __p,
size_t __r>
1226 {
return !(__lhs == __rhs); }
1236 template<
typename _RandomNumberEngine,
size_t __w,
typename _UIntType>
1240 "result_type must be an unsigned integral type");
1241 static_assert(0u < __w && __w <= std::numeric_limits<_UIntType>::digits,
1242 "template argument substituting __w out of bounds");
1244 template<
typename _Sseq>
1296 template<
typename _Sseq,
typename = _If_seed_seq<_Sseq>>
1323 template<
typename _Sseq>
1332 const _RandomNumberEngine&
1333 base() const noexcept
1348 {
return __detail::_Shift<_UIntType, __w>::__value - 1; }
1354 discard(
unsigned long long __z)
1356 for (; __z != 0ULL; --__z)
1381 {
return __lhs._M_b == __rhs._M_b; }
1395 template<
typename _CharT,
typename _Traits>
1399 __w, _UIntType>& __x)
1406 _RandomNumberEngine _M_b;
1409#if __cpp_impl_three_way_comparison < 201907L
1422 template<
typename _RandomNumberEngine,
size_t __w,
typename _UIntType>
1428 {
return !(__lhs == __rhs); }
1441 template<
typename _RandomNumberEngine,
size_t __w,
typename _UIntType,
1442 typename _CharT,
typename _Traits>
1443 std::basic_ostream<_CharT, _Traits>&
1444 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
1445 const std::independent_bits_engine<_RandomNumberEngine,
1446 __w, _UIntType>& __x)
1463 template<
typename _RandomNumberEngine,
size_t __k>
1466 static_assert(1u <= __k,
"template argument substituting "
1467 "__k out of bound");
1473 template<
typename _Sseq>
1478 static constexpr size_t table_size = __k;
1487 { _M_initialize(); }
1498 { _M_initialize(); }
1509 { _M_initialize(); }
1520 { _M_initialize(); }
1527 template<
typename _Sseq,
typename = _If_seed_seq<_Sseq>>
1531 { _M_initialize(); }
1560 template<
typename _Sseq>
1571 const _RandomNumberEngine&
1572 base() const noexcept
1580 {
return _RandomNumberEngine::min(); }
1587 {
return _RandomNumberEngine::max(); }
1593 discard(
unsigned long long __z)
1595 for (; __z != 0ULL; --__z)
1619 {
return (__lhs._M_b == __rhs._M_b
1620 && std::equal(__lhs._M_v, __lhs._M_v + __k, __rhs._M_v)
1621 && __lhs._M_y == __rhs._M_y); }
1634 template<
typename _RandomNumberEngine1,
size_t __k1,
1635 typename _CharT,
typename _Traits>
1652 template<
typename _RandomNumberEngine1,
size_t __k1,
1653 typename _CharT,
typename _Traits>
1659 void _M_initialize()
1661 for (
size_t __i = 0; __i < __k; ++__i)
1666 _RandomNumberEngine _M_b;
1667 result_type _M_v[__k];
1671#if __cpp_impl_three_way_comparison < 201907L
1683 template<
typename _RandomNumberEngine,
size_t __k>
1689 {
return !(__lhs == __rhs); }
1692#if __glibcxx_philox_engine
1721 template<
typename _UIntType,
size_t __w,
size_t __n,
size_t __r,
1722 _UIntType... __consts>
1725 static_assert(__n == 2 || __n == 4,
1726 "template argument N must be either 2 or 4");
1727 static_assert(
sizeof...(__consts) == __n,
1728 "length of consts array must match specified N");
1729 static_assert(0 < __r,
"a number of rounds must be specified");
1730 static_assert((0 < __w && __w <= numeric_limits<_UIntType>::digits),
1731 "specified bitlength must match input type");
1733 template<
typename _Sseq>
1734 static constexpr bool __is_seed_seq =
requires {
1735 typename __detail::_If_seed_seq_for<_Sseq, philox_engine, _UIntType>;
1738 template <
size_t __ind0,
size_t __ind1>
1740 array<_UIntType, __n / 2>
1743 if constexpr (__n == 4)
1744 return {__consts...[__ind0], __consts...[__ind1]};
1746 return {__consts...[__ind0]};
1750 using result_type = _UIntType;
1752 static constexpr size_t word_size = __w;
1753 static constexpr size_t word_count = __n;
1754 static constexpr size_t round_count = __r;
1755 static constexpr array<result_type, __n / 2> multipliers
1756 = _S_popArray<0,2>();
1757 static constexpr array<result_type, __n / 2> round_consts
1758 = _S_popArray<1,3>();
1761 static constexpr result_type
1766 static constexpr result_type
1769 return ((1ull << (__w - 1)) | ((1ull << (__w - 1)) - 1));
1772 static constexpr result_type default_seed = 20111115u;
1776 : philox_engine(default_seed)
1780 philox_engine(result_type __value)
1781 : _M_x{}, _M_y{}, _M_k{}, _M_i(__n - 1)
1782 { _M_k[0] = __value & max(); }
1788 template<
typename _Sseq>
requires __is_seed_seq<_Sseq>
1790 philox_engine(_Sseq& __q)
1796 seed(result_type __value = default_seed)
1801 _M_k[0] = __value & max();
1809 template<
typename _Sseq>
1811 seed(_Sseq& __q)
requires __is_seed_seq<_Sseq>;
1818 set_counter(
const array<result_type, __n>& __counter)
1820 for (
size_t __j = 0; __j < __n; ++__j)
1821 _M_x[__j] = __counter[__n - 1 - __j] & max();
1831 operator==(
const philox_engine&,
const philox_engine&) =
default;
1849 discard(
unsigned long long __z)
1862 template<
typename _CharT,
typename _Traits>
1863 friend basic_ostream<_CharT, _Traits>&
1864 operator<<(basic_ostream<_CharT, _Traits>& __os,
1865 const philox_engine& __x)
1867 const typename ios_base::fmtflags __flags = __os.flags();
1868 const _CharT __fill = __os.fill();
1869 __os.flags(ios_base::dec | ios_base::left);
1870 _CharT __space = __os.widen(
' ');
1872 for (
auto& __subkey : __x._M_k)
1873 __os << __subkey << __space;
1874 for (
auto& __ctr : __x._M_x)
1875 __os << __ctr << __space;
1877 __os.flags(__flags);
1889 template <
typename _CharT,
typename _Traits>
1890 friend basic_istream<_CharT, _Traits>&
1891 operator>>(basic_istream<_CharT, _Traits>& __is,
1894 const typename ios_base::fmtflags __flags = __is.flags();
1895 __is.flags(ios_base::dec | ios_base::skipws);
1896 for (
auto& __subkey : __x._M_k)
1898 for (
auto& __ctr : __x._M_x)
1900 array<_UIntType, __n> __tmpCtr = __x._M_x;
1901 unsigned char __setIndex = 0;
1902 for (
size_t __j = 0; __j < __x._M_x.size(); ++__j)
1904 if (__x._M_x[__j] > 0)
1910 for (
size_t __j = 0; __j <= __setIndex; ++__j)
1912 if (__j != __setIndex)
1913 __x._M_x[__j] = max();
1918 __x._M_x = __tmpCtr;
1920 __is.flags(__flags);
1926 array<_UIntType, __n> _M_x;
1927 array<_UIntType, __n / 2> _M_k;
1928 array<_UIntType, __n> _M_y;
1929 unsigned long long _M_i = 0;
1933 _S_mulhi(_UIntType __a, _UIntType __b);
1937 _S_mullo(_UIntType __a, _UIntType __b);
1983 0xb5026f5aa96619e9ULL, 29,
1984 0x5555555555555555ULL, 17,
1985 0x71d67fffeda60000ULL, 37,
1986 0xfff7eee000000000ULL, 43,
2003#if __glibcxx_philox_engine
2006 typedef philox_engine<
2009 0xCD9E8D57, 0x9E3779B9,
2010 0xD2511F53, 0xBB67AE85> philox4x32;
2013 typedef philox_engine<
2016 0xCA5A826395121157, 0x9E3779B97F4A7C15,
2017 0xD2E7470EE14C6C93, 0xBB67AE8584CAA73B> philox4x64;
2035 random_device() { _M_init(
"default"); }
2052 entropy() const noexcept
2053 {
return this->_M_getentropy(); }
2057 {
return this->_M_getval(); }
2060 random_device(
const random_device&) =
delete;
2061 void operator=(
const random_device&) =
delete;
2071 double _M_getentropy() const noexcept;
2073 void _M_init(const
char*,
size_t);
2103#if __cpp_impl_three_way_comparison < 201907L
2108 template<
typename _IntType>
2110 operator!=(
const std::uniform_int_distribution<_IntType>& __d1,
2111 const std::uniform_int_distribution<_IntType>& __d2)
2112 {
return !(__d1 == __d2); }
2125 template<
typename _IntType,
typename _CharT,
typename _Traits>
2126 std::basic_ostream<_CharT, _Traits>&
2127 operator<<(std::basic_ostream<_CharT, _Traits>&,
2128 const std::uniform_int_distribution<_IntType>&);
2139 template<
typename _IntType,
typename _CharT,
typename _Traits>
2140 std::basic_istream<_CharT, _Traits>&
2141 operator>>(std::basic_istream<_CharT, _Traits>&,
2142 std::uniform_int_distribution<_IntType>&);
2155 template<
typename _RealType =
double>
2159 "result_type must be a floating point type");
2170 param_type() : param_type(0) { }
2173 param_type(_RealType __a, _RealType __b = _RealType(1))
2174 : _M_a(__a), _M_b(__b)
2176 __glibcxx_assert(_M_a <= _M_b);
2188 operator==(
const param_type& __p1,
const param_type& __p2)
2189 {
return __p1._M_a == __p2._M_a && __p1._M_b == __p2._M_b; }
2191#if __cpp_impl_three_way_comparison < 201907L
2193 operator!=(
const param_type& __p1,
const param_type& __p2)
2194 {
return !(__p1 == __p2); }
2218 : _M_param(__a, __b)
2236 {
return _M_param.a(); }
2240 {
return _M_param.b(); }
2247 {
return _M_param; }
2255 { _M_param = __param; }
2262 {
return this->a(); }
2269 {
return this->b(); }
2274 template<
typename _UniformRandomNumberGenerator>
2277 {
return this->
operator()(__urng, _M_param); }
2279 template<
typename _UniformRandomNumberGenerator>
2281 operator()(_UniformRandomNumberGenerator& __urng,
2282 const param_type& __p)
2284 __detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
2286 return (__aurng() * (__p.b() - __p.a())) + __p.a();
2289 template<
typename _ForwardIterator,
2290 typename _UniformRandomNumberGenerator>
2292 __generate(_ForwardIterator __f, _ForwardIterator __t,
2293 _UniformRandomNumberGenerator& __urng)
2294 { this->__generate(__f, __t, __urng, _M_param); }
2296 template<
typename _ForwardIterator,
2297 typename _UniformRandomNumberGenerator>
2299 __generate(_ForwardIterator __f, _ForwardIterator __t,
2300 _UniformRandomNumberGenerator& __urng,
2302 { this->__generate_impl(__f, __t, __urng, __p); }
2304 template<
typename _UniformRandomNumberGenerator>
2307 _UniformRandomNumberGenerator& __urng,
2309 { this->__generate_impl(__f, __t, __urng, __p); }
2318 {
return __d1._M_param == __d2._M_param; }
2321 template<
typename _ForwardIterator,
2322 typename _UniformRandomNumberGenerator>
2324 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
2325 _UniformRandomNumberGenerator& __urng,
2326 const param_type& __p);
2328 param_type _M_param;
2331#if __cpp_impl_three_way_comparison < 201907L
2336 template<
typename _IntType>
2340 {
return !(__d1 == __d2); }
2353 template<
typename _RealType,
typename _CharT,
typename _Traits>
2354 std::basic_ostream<_CharT, _Traits>&
2355 operator<<(std::basic_ostream<_CharT, _Traits>&,
2356 const std::uniform_real_distribution<_RealType>&);
2367 template<
typename _RealType,
typename _CharT,
typename _Traits>
2368 std::basic_istream<_CharT, _Traits>&
2369 operator>>(std::basic_istream<_CharT, _Traits>&,
2370 std::uniform_real_distribution<_RealType>&);
2392 template<
typename _RealType =
double>
2393 class normal_distribution
2396 "result_type must be a floating point type");
2405 typedef normal_distribution<_RealType> distribution_type;
2407 param_type() : param_type(0.0) { }
2410 param_type(_RealType __mean, _RealType __stddev = _RealType(1))
2411 : _M_mean(__mean), _M_stddev(__stddev)
2413 __glibcxx_assert(_M_stddev > _RealType(0));
2422 {
return _M_stddev; }
2425 operator==(
const param_type& __p1,
const param_type& __p2)
2426 {
return (__p1._M_mean == __p2._M_mean
2427 && __p1._M_stddev == __p2._M_stddev); }
2429#if __cpp_impl_three_way_comparison < 201907L
2431 operator!=(
const param_type& __p1,
const param_type& __p2)
2432 {
return !(__p1 == __p2); }
2437 _RealType _M_stddev;
2441 normal_distribution() : normal_distribution(0.0) { }
2450 : _M_param(__mean, __stddev)
2463 { _M_saved_available =
false; }
2470 {
return _M_param.mean(); }
2477 {
return _M_param.stddev(); }
2484 {
return _M_param; }
2492 { _M_param = __param; }
2511 template<
typename _UniformRandomNumberGenerator>
2514 {
return this->
operator()(__urng, _M_param); }
2516 template<
typename _UniformRandomNumberGenerator>
2519 const param_type& __p);
2521 template<
typename _ForwardIterator,
2522 typename _UniformRandomNumberGenerator>
2524 __generate(_ForwardIterator __f, _ForwardIterator __t,
2525 _UniformRandomNumberGenerator& __urng)
2526 { this->__generate(__f, __t, __urng, _M_param); }
2528 template<
typename _ForwardIterator,
2529 typename _UniformRandomNumberGenerator>
2531 __generate(_ForwardIterator __f, _ForwardIterator __t,
2532 _UniformRandomNumberGenerator& __urng,
2533 const param_type& __p)
2534 { this->__generate_impl(__f, __t, __urng, __p); }
2536 template<
typename _UniformRandomNumberGenerator>
2538 __generate(result_type* __f, result_type* __t,
2539 _UniformRandomNumberGenerator& __urng,
2540 const param_type& __p)
2541 { this->__generate_impl(__f, __t, __urng, __p); }
2548 template<
typename _RealType1>
2563 template<
typename _RealType1,
typename _CharT,
typename _Traits>
2578 template<
typename _RealType1,
typename _CharT,
typename _Traits>
2584 template<
typename _ForwardIterator,
2585 typename _UniformRandomNumberGenerator>
2587 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
2588 _UniformRandomNumberGenerator& __urng,
2589 const param_type& __p);
2591 param_type _M_param;
2593 bool _M_saved_available =
false;
2596#if __cpp_impl_three_way_comparison < 201907L
2600 template<
typename _RealType>
2604 {
return !(__d1 == __d2); }
2619 template<
typename _RealType =
double>
2620 class lognormal_distribution
2623 "result_type must be a floating point type");
2632 typedef lognormal_distribution<_RealType> distribution_type;
2634 param_type() : param_type(0.0) { }
2637 param_type(_RealType __m, _RealType __s = _RealType(1))
2638 : _M_m(__m), _M_s(__s)
2650 operator==(
const param_type& __p1,
const param_type& __p2)
2651 {
return __p1._M_m == __p2._M_m && __p1._M_s == __p2._M_s; }
2653#if __cpp_impl_three_way_comparison < 201907L
2655 operator!=(
const param_type& __p1,
const param_type& __p2)
2656 {
return !(__p1 == __p2); }
2664 lognormal_distribution() : lognormal_distribution(0.0) { }
2668 : _M_param(__m, __s), _M_nd()
2672 lognormal_distribution(
const param_type& __p)
2673 : _M_param(__p), _M_nd()
2688 {
return _M_param.m(); }
2692 {
return _M_param.s(); }
2699 {
return _M_param; }
2707 { _M_param = __param; }
2726 template<
typename _UniformRandomNumberGenerator>
2729 {
return this->
operator()(__urng, _M_param); }
2731 template<
typename _UniformRandomNumberGenerator>
2733 operator()(_UniformRandomNumberGenerator& __urng,
2734 const param_type& __p)
2735 {
return std::exp(__p.s() * _M_nd(__urng) + __p.m()); }
2737 template<
typename _ForwardIterator,
2738 typename _UniformRandomNumberGenerator>
2740 __generate(_ForwardIterator __f, _ForwardIterator __t,
2741 _UniformRandomNumberGenerator& __urng)
2742 { this->__generate(__f, __t, __urng, _M_param); }
2744 template<
typename _ForwardIterator,
2745 typename _UniformRandomNumberGenerator>
2747 __generate(_ForwardIterator __f, _ForwardIterator __t,
2748 _UniformRandomNumberGenerator& __urng,
2750 { this->__generate_impl(__f, __t, __urng, __p); }
2752 template<
typename _UniformRandomNumberGenerator>
2755 _UniformRandomNumberGenerator& __urng,
2757 { this->__generate_impl(__f, __t, __urng, __p); }
2766 const lognormal_distribution& __d2)
2767 {
return (__d1._M_param == __d2._M_param
2768 && __d1._M_nd == __d2._M_nd); }
2780 template<
typename _RealType1,
typename _CharT,
typename _Traits>
2795 template<
typename _RealType1,
typename _CharT,
typename _Traits>
2801 template<
typename _ForwardIterator,
2802 typename _UniformRandomNumberGenerator>
2804 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
2805 _UniformRandomNumberGenerator& __urng,
2806 const param_type& __p);
2808 param_type _M_param;
2813#if __cpp_impl_three_way_comparison < 201907L
2817 template<
typename _RealType>
2821 {
return !(__d1 == __d2); }
2844 template<
typename _RealType =
double>
2848 "result_type must be a floating point type");
2860 param_type() : param_type(1.0) { }
2863 param_type(_RealType __alpha_val, _RealType __beta_val = _RealType(1))
2864 : _M_alpha(__alpha_val), _M_beta(__beta_val)
2866 __glibcxx_assert(_M_alpha > _RealType(0));
2872 {
return _M_alpha; }
2879 operator==(
const param_type& __p1,
const param_type& __p2)
2880 {
return (__p1._M_alpha == __p2._M_alpha
2881 && __p1._M_beta == __p2._M_beta); }
2883#if __cpp_impl_three_way_comparison < 201907L
2885 operator!=(
const param_type& __p1,
const param_type& __p2)
2886 {
return !(__p1 == __p2); }
2896 _RealType _M_malpha, _M_a2;
2911 _RealType __beta_val = _RealType(1))
2912 : _M_param(__alpha_val, __beta_val), _M_nd()
2917 : _M_param(__p), _M_nd()
2932 {
return _M_param.alpha(); }
2939 {
return _M_param.beta(); }
2946 {
return _M_param; }
2954 { _M_param = __param; }
2973 template<
typename _UniformRandomNumberGenerator>
2976 {
return this->
operator()(__urng, _M_param); }
2978 template<
typename _UniformRandomNumberGenerator>
2981 const param_type& __p);
2983 template<
typename _ForwardIterator,
2984 typename _UniformRandomNumberGenerator>
2986 __generate(_ForwardIterator __f, _ForwardIterator __t,
2987 _UniformRandomNumberGenerator& __urng)
2988 { this->__generate(__f, __t, __urng, _M_param); }
2990 template<
typename _ForwardIterator,
2991 typename _UniformRandomNumberGenerator>
2993 __generate(_ForwardIterator __f, _ForwardIterator __t,
2994 _UniformRandomNumberGenerator& __urng,
2995 const param_type& __p)
2996 { this->__generate_impl(__f, __t, __urng, __p); }
2998 template<
typename _UniformRandomNumberGenerator>
3000 __generate(result_type* __f, result_type* __t,
3001 _UniformRandomNumberGenerator& __urng,
3002 const param_type& __p)
3003 { this->__generate_impl(__f, __t, __urng, __p); }
3013 {
return (__d1._M_param == __d2._M_param
3014 && __d1._M_nd == __d2._M_nd); }
3026 template<
typename _RealType1,
typename _CharT,
typename _Traits>
3040 template<
typename _RealType1,
typename _CharT,
typename _Traits>
3046 template<
typename _ForwardIterator,
3047 typename _UniformRandomNumberGenerator>
3049 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
3050 _UniformRandomNumberGenerator& __urng,
3051 const param_type& __p);
3053 param_type _M_param;
3058#if __cpp_impl_three_way_comparison < 201907L
3062 template<
typename _RealType>
3066 {
return !(__d1 == __d2); }
3086 template<
typename _RealType =
double>
3087 class chi_squared_distribution
3090 "result_type must be a floating point type");
3099 typedef chi_squared_distribution<_RealType> distribution_type;
3101 param_type() : param_type(1) { }
3104 param_type(_RealType __n)
3113 operator==(
const param_type& __p1,
const param_type& __p2)
3114 {
return __p1._M_n == __p2._M_n; }
3116#if __cpp_impl_three_way_comparison < 201907L
3118 operator!=(
const param_type& __p1,
const param_type& __p2)
3119 {
return !(__p1 == __p2); }
3126 chi_squared_distribution() : chi_squared_distribution(1) { }
3130 : _M_param(__n), _M_gd(__n / 2)
3134 chi_squared_distribution(
const param_type& __p)
3135 : _M_param(__p), _M_gd(__p.n() / 2)
3150 {
return _M_param.n(); }
3157 {
return _M_param; }
3169 _M_gd.param(param_type{__param.n() / 2});
3189 template<
typename _UniformRandomNumberGenerator>
3192 {
return 2 * _M_gd(__urng); }
3194 template<
typename _UniformRandomNumberGenerator>
3196 operator()(_UniformRandomNumberGenerator& __urng,
3197 const param_type& __p)
3201 return 2 * _M_gd(__urng, param_type(__p.n() / 2));
3204 template<
typename _ForwardIterator,
3205 typename _UniformRandomNumberGenerator>
3207 __generate(_ForwardIterator __f, _ForwardIterator __t,
3208 _UniformRandomNumberGenerator& __urng)
3209 { this->__generate_impl(__f, __t, __urng); }
3211 template<
typename _ForwardIterator,
3212 typename _UniformRandomNumberGenerator>
3214 __generate(_ForwardIterator __f, _ForwardIterator __t,
3215 _UniformRandomNumberGenerator& __urng,
3217 {
typename std::gamma_distribution<result_type>::param_type
3219 this->__generate_impl(__f, __t, __urng, __p2); }
3221 template<
typename _UniformRandomNumberGenerator>
3224 _UniformRandomNumberGenerator& __urng)
3225 { this->__generate_impl(__f, __t, __urng); }
3227 template<
typename _UniformRandomNumberGenerator>
3230 _UniformRandomNumberGenerator& __urng,
3232 {
typename std::gamma_distribution<result_type>::param_type
3234 this->__generate_impl(__f, __t, __urng, __p2); }
3243 const chi_squared_distribution& __d2)
3244 {
return __d1._M_param == __d2._M_param && __d1._M_gd == __d2._M_gd; }
3256 template<
typename _RealType1,
typename _CharT,
typename _Traits>
3271 template<
typename _RealType1,
typename _CharT,
typename _Traits>
3277 template<
typename _ForwardIterator,
3278 typename _UniformRandomNumberGenerator>
3280 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
3281 _UniformRandomNumberGenerator& __urng);
3283 template<
typename _ForwardIterator,
3284 typename _UniformRandomNumberGenerator>
3286 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
3287 _UniformRandomNumberGenerator& __urng,
3291 param_type _M_param;
3296#if __cpp_impl_three_way_comparison < 201907L
3300 template<
typename _RealType>
3304 {
return !(__d1 == __d2); }
3316 template<
typename _RealType =
double>
3317 class cauchy_distribution
3320 "result_type must be a floating point type");
3329 typedef cauchy_distribution<_RealType> distribution_type;
3331 param_type() : param_type(0) { }
3334 param_type(_RealType __a, _RealType __b = _RealType(1))
3335 : _M_a(__a), _M_b(__b)
3347 operator==(
const param_type& __p1,
const param_type& __p2)
3348 {
return __p1._M_a == __p2._M_a && __p1._M_b == __p2._M_b; }
3350#if __cpp_impl_three_way_comparison < 201907L
3352 operator!=(
const param_type& __p1,
const param_type& __p2)
3353 {
return !(__p1 == __p2); }
3361 cauchy_distribution() : cauchy_distribution(0.0) { }
3365 : _M_param(__a, __b)
3369 cauchy_distribution(
const param_type& __p)
3385 {
return _M_param.a(); }
3389 {
return _M_param.b(); }
3396 {
return _M_param; }
3404 { _M_param = __param; }
3423 template<
typename _UniformRandomNumberGenerator>
3426 {
return this->
operator()(__urng, _M_param); }
3428 template<
typename _UniformRandomNumberGenerator>
3430 operator()(_UniformRandomNumberGenerator& __urng,
3431 const param_type& __p);
3433 template<
typename _ForwardIterator,
3434 typename _UniformRandomNumberGenerator>
3436 __generate(_ForwardIterator __f, _ForwardIterator __t,
3437 _UniformRandomNumberGenerator& __urng)
3438 { this->__generate(__f, __t, __urng, _M_param); }
3440 template<
typename _ForwardIterator,
3441 typename _UniformRandomNumberGenerator>
3443 __generate(_ForwardIterator __f, _ForwardIterator __t,
3444 _UniformRandomNumberGenerator& __urng,
3445 const param_type& __p)
3446 { this->__generate_impl(__f, __t, __urng, __p); }
3448 template<
typename _UniformRandomNumberGenerator>
3451 _UniformRandomNumberGenerator& __urng,
3453 { this->__generate_impl(__f, __t, __urng, __p); }
3461 const cauchy_distribution& __d2)
3462 {
return __d1._M_param == __d2._M_param; }
3465 template<
typename _ForwardIterator,
3466 typename _UniformRandomNumberGenerator>
3468 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
3469 _UniformRandomNumberGenerator& __urng,
3470 const param_type& __p);
3472 param_type _M_param;
3475#if __cpp_impl_three_way_comparison < 201907L
3480 template<
typename _RealType>
3484 {
return !(__d1 == __d2); }
3497 template<
typename _RealType,
typename _CharT,
typename _Traits>
3498 std::basic_ostream<_CharT, _Traits>&
3499 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
3500 const std::cauchy_distribution<_RealType>& __x);
3512 template<
typename _RealType,
typename _CharT,
typename _Traits>
3513 std::basic_istream<_CharT, _Traits>&
3514 operator>>(std::basic_istream<_CharT, _Traits>& __is,
3515 std::cauchy_distribution<_RealType>& __x);
3531 template<
typename _RealType =
double>
3532 class fisher_f_distribution
3535 "result_type must be a floating point type");
3544 typedef fisher_f_distribution<_RealType> distribution_type;
3546 param_type() : param_type(1) { }
3549 param_type(_RealType __m, _RealType __n = _RealType(1))
3550 : _M_m(__m), _M_n(__n)
3562 operator==(
const param_type& __p1,
const param_type& __p2)
3563 {
return __p1._M_m == __p2._M_m && __p1._M_n == __p2._M_n; }
3565#if __cpp_impl_three_way_comparison < 201907L
3567 operator!=(
const param_type& __p1,
const param_type& __p2)
3568 {
return !(__p1 == __p2); }
3576 fisher_f_distribution() : fisher_f_distribution(1.0) { }
3580 _RealType __n = _RealType(1))
3581 : _M_param(__m, __n), _M_gd_x(__m / 2), _M_gd_y(__n / 2)
3585 fisher_f_distribution(
const param_type& __p)
3586 : _M_param(__p), _M_gd_x(__p.m() / 2), _M_gd_y(__p.n() / 2)
3604 {
return _M_param.m(); }
3608 {
return _M_param.n(); }
3615 {
return _M_param; }
3623 { _M_param = __param; }
3642 template<
typename _UniformRandomNumberGenerator>
3645 {
return (_M_gd_x(__urng) * n()) / (_M_gd_y(__urng) * m()); }
3647 template<
typename _UniformRandomNumberGenerator>
3649 operator()(_UniformRandomNumberGenerator& __urng,
3650 const param_type& __p)
3654 return ((_M_gd_x(__urng, param_type(__p.m() / 2)) * n())
3655 / (_M_gd_y(__urng, param_type(__p.n() / 2)) * m()));
3658 template<
typename _ForwardIterator,
3659 typename _UniformRandomNumberGenerator>
3661 __generate(_ForwardIterator __f, _ForwardIterator __t,
3662 _UniformRandomNumberGenerator& __urng)
3663 { this->__generate_impl(__f, __t, __urng); }
3665 template<
typename _ForwardIterator,
3666 typename _UniformRandomNumberGenerator>
3668 __generate(_ForwardIterator __f, _ForwardIterator __t,
3669 _UniformRandomNumberGenerator& __urng,
3671 { this->__generate_impl(__f, __t, __urng, __p); }
3673 template<
typename _UniformRandomNumberGenerator>
3676 _UniformRandomNumberGenerator& __urng)
3677 { this->__generate_impl(__f, __t, __urng); }
3679 template<
typename _UniformRandomNumberGenerator>
3682 _UniformRandomNumberGenerator& __urng,
3684 { this->__generate_impl(__f, __t, __urng, __p); }
3693 const fisher_f_distribution& __d2)
3694 {
return (__d1._M_param == __d2._M_param
3695 && __d1._M_gd_x == __d2._M_gd_x
3696 && __d1._M_gd_y == __d2._M_gd_y); }
3708 template<
typename _RealType1,
typename _CharT,
typename _Traits>
3723 template<
typename _RealType1,
typename _CharT,
typename _Traits>
3729 template<
typename _ForwardIterator,
3730 typename _UniformRandomNumberGenerator>
3732 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
3733 _UniformRandomNumberGenerator& __urng);
3735 template<
typename _ForwardIterator,
3736 typename _UniformRandomNumberGenerator>
3738 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
3739 _UniformRandomNumberGenerator& __urng,
3740 const param_type& __p);
3742 param_type _M_param;
3747#if __cpp_impl_three_way_comparison < 201907L
3751 template<
typename _RealType>
3755 {
return !(__d1 == __d2); }
3770 template<
typename _RealType =
double>
3771 class student_t_distribution
3774 "result_type must be a floating point type");
3783 typedef student_t_distribution<_RealType> distribution_type;
3785 param_type() : param_type(1) { }
3788 param_type(_RealType __n)
3797 operator==(
const param_type& __p1,
const param_type& __p2)
3798 {
return __p1._M_n == __p2._M_n; }
3800#if __cpp_impl_three_way_comparison < 201907L
3802 operator!=(
const param_type& __p1,
const param_type& __p2)
3803 {
return !(__p1 == __p2); }
3810 student_t_distribution() : student_t_distribution(1.0) { }
3814 : _M_param(__n), _M_nd(), _M_gd(__n / 2, 2)
3818 student_t_distribution(
const param_type& __p)
3819 : _M_param(__p), _M_nd(), _M_gd(__p.n() / 2, 2)
3837 {
return _M_param.n(); }
3844 {
return _M_param; }
3852 { _M_param = __param; }
3871 template<
typename _UniformRandomNumberGenerator>
3874 {
return _M_nd(__urng) *
std::sqrt(n() / _M_gd(__urng)); }
3876 template<
typename _UniformRandomNumberGenerator>
3878 operator()(_UniformRandomNumberGenerator& __urng,
3879 const param_type& __p)
3884 const result_type __g = _M_gd(__urng, param_type(__p.n() / 2, 2));
3885 return _M_nd(__urng) *
std::sqrt(__p.n() / __g);
3888 template<
typename _ForwardIterator,
3889 typename _UniformRandomNumberGenerator>
3891 __generate(_ForwardIterator __f, _ForwardIterator __t,
3892 _UniformRandomNumberGenerator& __urng)
3893 { this->__generate_impl(__f, __t, __urng); }
3895 template<
typename _ForwardIterator,
3896 typename _UniformRandomNumberGenerator>
3898 __generate(_ForwardIterator __f, _ForwardIterator __t,
3899 _UniformRandomNumberGenerator& __urng,
3901 { this->__generate_impl(__f, __t, __urng, __p); }
3903 template<
typename _UniformRandomNumberGenerator>
3906 _UniformRandomNumberGenerator& __urng)
3907 { this->__generate_impl(__f, __t, __urng); }
3909 template<
typename _UniformRandomNumberGenerator>
3912 _UniformRandomNumberGenerator& __urng,
3914 { this->__generate_impl(__f, __t, __urng, __p); }
3923 const student_t_distribution& __d2)
3924 {
return (__d1._M_param == __d2._M_param
3925 && __d1._M_nd == __d2._M_nd && __d1._M_gd == __d2._M_gd); }
3937 template<
typename _RealType1,
typename _CharT,
typename _Traits>
3952 template<
typename _RealType1,
typename _CharT,
typename _Traits>
3958 template<
typename _ForwardIterator,
3959 typename _UniformRandomNumberGenerator>
3961 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
3962 _UniformRandomNumberGenerator& __urng);
3963 template<
typename _ForwardIterator,
3964 typename _UniformRandomNumberGenerator>
3966 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
3967 _UniformRandomNumberGenerator& __urng,
3968 const param_type& __p);
3970 param_type _M_param;
3976#if __cpp_impl_three_way_comparison < 201907L
3980 template<
typename _RealType>
3984 {
return !(__d1 == __d2); }
4015 param_type() : param_type(0.5) { }
4018 param_type(
double __p)
4021 __glibcxx_assert((_M_p >= 0.0) && (_M_p <= 1.0));
4029 operator==(
const param_type& __p1,
const param_type& __p2)
4030 {
return __p1._M_p == __p2._M_p; }
4032#if __cpp_impl_three_way_comparison < 201907L
4034 operator!=(
const param_type& __p1,
const param_type& __p2)
4035 {
return !(__p1 == __p2); }
4077 {
return _M_param.p(); }
4084 {
return _M_param; }
4092 { _M_param = __param; }
4111 template<
typename _UniformRandomNumberGenerator>
4114 {
return this->
operator()(__urng, _M_param); }
4116 template<
typename _UniformRandomNumberGenerator>
4118 operator()(_UniformRandomNumberGenerator& __urng,
4119 const param_type& __p)
4121 __detail::_Adaptor<_UniformRandomNumberGenerator, double>
4123 if ((__aurng() - __aurng.min())
4124 < __p.p() * (__aurng.max() - __aurng.min()))
4129 template<
typename _ForwardIterator,
4130 typename _UniformRandomNumberGenerator>
4132 __generate(_ForwardIterator __f, _ForwardIterator __t,
4133 _UniformRandomNumberGenerator& __urng)
4134 { this->__generate(__f, __t, __urng, _M_param); }
4136 template<
typename _ForwardIterator,
4137 typename _UniformRandomNumberGenerator>
4139 __generate(_ForwardIterator __f, _ForwardIterator __t,
4140 _UniformRandomNumberGenerator& __urng,
const param_type& __p)
4141 { this->__generate_impl(__f, __t, __urng, __p); }
4143 template<
typename _UniformRandomNumberGenerator>
4146 _UniformRandomNumberGenerator& __urng,
4148 { this->__generate_impl(__f, __t, __urng, __p); }
4157 {
return __d1._M_param == __d2._M_param; }
4160 template<
typename _ForwardIterator,
4161 typename _UniformRandomNumberGenerator>
4163 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
4164 _UniformRandomNumberGenerator& __urng,
4165 const param_type& __p);
4167 param_type _M_param;
4170#if __cpp_impl_three_way_comparison < 201907L
4178 {
return !(__d1 == __d2); }
4191 template<
typename _CharT,
typename _Traits>
4192 std::basic_ostream<_CharT, _Traits>&
4193 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
4194 const std::bernoulli_distribution& __x);
4205 template<
typename _CharT,
typename _Traits>
4206 inline std::basic_istream<_CharT, _Traits>&
4227 template<
typename _IntType =
int>
4228 class binomial_distribution
4231 "result_type must be an integral type");
4240 typedef binomial_distribution<_IntType> distribution_type;
4241 friend class binomial_distribution<_IntType>;
4243 param_type() : param_type(1) { }
4246 param_type(_IntType __t,
double __p = 0.5)
4247 : _M_t(__t), _M_p(__p)
4249 __glibcxx_assert((_M_t >= _IntType(0))
4264 operator==(
const param_type& __p1,
const param_type& __p2)
4265 {
return __p1._M_t == __p2._M_t && __p1._M_p == __p2._M_p; }
4267#if __cpp_impl_three_way_comparison < 201907L
4269 operator!=(
const param_type& __p1,
const param_type& __p2)
4270 {
return !(__p1 == __p2); }
4281#if _GLIBCXX_USE_C99_MATH_FUNCS
4282 double _M_d1, _M_d2, _M_s1, _M_s2, _M_c,
4283 _M_a1, _M_a123, _M_s, _M_lf, _M_lp1p;
4290 binomial_distribution() : binomial_distribution(1) { }
4294 : _M_param(__t, __p), _M_nd()
4298 binomial_distribution(
const param_type& __p)
4299 : _M_param(__p), _M_nd()
4314 {
return _M_param.t(); }
4321 {
return _M_param.p(); }
4328 {
return _M_param; }
4336 { _M_param = __param; }
4350 {
return _M_param.t(); }
4355 template<
typename _UniformRandomNumberGenerator>
4358 {
return this->
operator()(__urng, _M_param); }
4360 template<
typename _UniformRandomNumberGenerator>
4363 const param_type& __p);
4365 template<
typename _ForwardIterator,
4366 typename _UniformRandomNumberGenerator>
4368 __generate(_ForwardIterator __f, _ForwardIterator __t,
4369 _UniformRandomNumberGenerator& __urng)
4370 { this->__generate(__f, __t, __urng, _M_param); }
4372 template<
typename _ForwardIterator,
4373 typename _UniformRandomNumberGenerator>
4375 __generate(_ForwardIterator __f, _ForwardIterator __t,
4376 _UniformRandomNumberGenerator& __urng,
4377 const param_type& __p)
4378 { this->__generate_impl(__f, __t, __urng, __p); }
4380 template<
typename _UniformRandomNumberGenerator>
4382 __generate(result_type* __f, result_type* __t,
4383 _UniformRandomNumberGenerator& __urng,
4384 const param_type& __p)
4385 { this->__generate_impl(__f, __t, __urng, __p); }
4394 const binomial_distribution& __d2)
4395#ifdef _GLIBCXX_USE_C99_MATH_FUNCS
4396 {
return __d1._M_param == __d2._M_param && __d1._M_nd == __d2._M_nd; }
4398 {
return __d1._M_param == __d2._M_param; }
4411 template<
typename _IntType1,
4412 typename _CharT,
typename _Traits>
4427 template<
typename _IntType1,
4428 typename _CharT,
typename _Traits>
4434 template<
typename _ForwardIterator,
4435 typename _UniformRandomNumberGenerator>
4437 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
4438 _UniformRandomNumberGenerator& __urng,
4439 const param_type& __p);
4441 template<
typename _UniformRandomNumberGenerator>
4443 _M_waiting(_UniformRandomNumberGenerator& __urng,
4444 _IntType __t,
double __q);
4446 param_type _M_param;
4452#if __cpp_impl_three_way_comparison < 201907L
4456 template<
typename _IntType>
4460 {
return !(__d1 == __d2); }
4473 template<
typename _IntType =
int>
4474 class geometric_distribution
4477 "result_type must be an integral type");
4486 typedef geometric_distribution<_IntType> distribution_type;
4487 friend class geometric_distribution<_IntType>;
4489 param_type() : param_type(0.5) { }
4492 param_type(
double __p)
4495 __glibcxx_assert((_M_p > 0.0) && (_M_p < 1.0));
4504 operator==(
const param_type& __p1,
const param_type& __p2)
4505 {
return __p1._M_p == __p2._M_p; }
4507#if __cpp_impl_three_way_comparison < 201907L
4509 operator!=(
const param_type& __p1,
const param_type& __p2)
4510 {
return !(__p1 == __p2); }
4516 { _M_log_1_p =
std::log(1.0 - _M_p); }
4525 geometric_distribution() : geometric_distribution(0.5) { }
4533 geometric_distribution(
const param_type& __p)
4550 {
return _M_param.p(); }
4557 {
return _M_param; }
4565 { _M_param = __param; }
4584 template<
typename _UniformRandomNumberGenerator>
4587 {
return this->
operator()(__urng, _M_param); }
4589 template<
typename _UniformRandomNumberGenerator>
4591 operator()(_UniformRandomNumberGenerator& __urng,
4592 const param_type& __p);
4594 template<
typename _ForwardIterator,
4595 typename _UniformRandomNumberGenerator>
4597 __generate(_ForwardIterator __f, _ForwardIterator __t,
4598 _UniformRandomNumberGenerator& __urng)
4599 { this->__generate(__f, __t, __urng, _M_param); }
4601 template<
typename _ForwardIterator,
4602 typename _UniformRandomNumberGenerator>
4604 __generate(_ForwardIterator __f, _ForwardIterator __t,
4605 _UniformRandomNumberGenerator& __urng,
4606 const param_type& __p)
4607 { this->__generate_impl(__f, __t, __urng, __p); }
4609 template<
typename _UniformRandomNumberGenerator>
4612 _UniformRandomNumberGenerator& __urng,
4614 { this->__generate_impl(__f, __t, __urng, __p); }
4622 const geometric_distribution& __d2)
4623 {
return __d1._M_param == __d2._M_param; }
4626 template<
typename _ForwardIterator,
4627 typename _UniformRandomNumberGenerator>
4629 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
4630 _UniformRandomNumberGenerator& __urng,
4631 const param_type& __p);
4633 param_type _M_param;
4636#if __cpp_impl_three_way_comparison < 201907L
4641 template<
typename _IntType>
4645 {
return !(__d1 == __d2); }
4658 template<
typename _IntType,
4659 typename _CharT,
typename _Traits>
4660 std::basic_ostream<_CharT, _Traits>&
4661 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
4662 const std::geometric_distribution<_IntType>& __x);
4673 template<
typename _IntType,
4674 typename _CharT,
typename _Traits>
4675 std::basic_istream<_CharT, _Traits>&
4676 operator>>(std::basic_istream<_CharT, _Traits>& __is,
4677 std::geometric_distribution<_IntType>& __x);
4690 template<
typename _IntType =
int>
4691 class negative_binomial_distribution
4694 "result_type must be an integral type");
4703 typedef negative_binomial_distribution<_IntType> distribution_type;
4705 param_type() : param_type(1) { }
4708 param_type(_IntType __k,
double __p = 0.5)
4709 : _M_k(__k), _M_p(__p)
4711 __glibcxx_assert((_M_k > 0) && (_M_p > 0.0) && (_M_p <= 1.0));
4723 operator==(
const param_type& __p1,
const param_type& __p2)
4724 {
return __p1._M_k == __p2._M_k && __p1._M_p == __p2._M_p; }
4726#if __cpp_impl_three_way_comparison < 201907L
4728 operator!=(
const param_type& __p1,
const param_type& __p2)
4729 {
return !(__p1 == __p2); }
4737 negative_binomial_distribution() : negative_binomial_distribution(1) { }
4741 : _M_param(__k, __p), _M_gd(__k, (1.0 - __p) / __p)
4745 negative_binomial_distribution(
const param_type& __p)
4746 : _M_param(__p), _M_gd(__p.
k(), (1.0 - __p.
p()) / __p.
p())
4761 {
return _M_param.k(); }
4768 {
return _M_param.p(); }
4775 {
return _M_param; }
4783 { _M_param = __param; }
4802 template<
typename _UniformRandomNumberGenerator>
4806 template<
typename _UniformRandomNumberGenerator>
4808 operator()(_UniformRandomNumberGenerator& __urng,
4809 const param_type& __p);
4811 template<
typename _ForwardIterator,
4812 typename _UniformRandomNumberGenerator>
4814 __generate(_ForwardIterator __f, _ForwardIterator __t,
4815 _UniformRandomNumberGenerator& __urng)
4816 { this->__generate_impl(__f, __t, __urng); }
4818 template<
typename _ForwardIterator,
4819 typename _UniformRandomNumberGenerator>
4821 __generate(_ForwardIterator __f, _ForwardIterator __t,
4822 _UniformRandomNumberGenerator& __urng,
4823 const param_type& __p)
4824 { this->__generate_impl(__f, __t, __urng, __p); }
4826 template<
typename _UniformRandomNumberGenerator>
4828 __generate(result_type* __f, result_type* __t,
4829 _UniformRandomNumberGenerator& __urng)
4830 { this->__generate_impl(__f, __t, __urng); }
4832 template<
typename _UniformRandomNumberGenerator>
4835 _UniformRandomNumberGenerator& __urng,
4837 { this->__generate_impl(__f, __t, __urng, __p); }
4846 const negative_binomial_distribution& __d2)
4847 {
return __d1._M_param == __d2._M_param && __d1._M_gd == __d2._M_gd; }
4860 template<
typename _IntType1,
typename _CharT,
typename _Traits>
4875 template<
typename _IntType1,
typename _CharT,
typename _Traits>
4881 template<
typename _ForwardIterator,
4882 typename _UniformRandomNumberGenerator>
4884 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
4885 _UniformRandomNumberGenerator& __urng);
4886 template<
typename _ForwardIterator,
4887 typename _UniformRandomNumberGenerator>
4889 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
4890 _UniformRandomNumberGenerator& __urng,
4891 const param_type& __p);
4893 param_type _M_param;
4898#if __cpp_impl_three_way_comparison < 201907L
4902 template<
typename _IntType>
4906 {
return !(__d1 == __d2); }
4927 template<
typename _IntType =
int>
4928 class poisson_distribution
4931 "result_type must be an integral type");
4940 typedef poisson_distribution<_IntType> distribution_type;
4941 friend class poisson_distribution<_IntType>;
4943 param_type() : param_type(1.0) { }
4946 param_type(
double __mean)
4949 __glibcxx_assert(_M_mean > 0.0);
4958 operator==(
const param_type& __p1,
const param_type& __p2)
4959 {
return __p1._M_mean == __p2._M_mean; }
4961#if __cpp_impl_three_way_comparison < 201907L
4963 operator!=(
const param_type& __p1,
const param_type& __p2)
4964 {
return !(__p1 == __p2); }
4975#if _GLIBCXX_USE_C99_MATH_FUNCS
4976 double _M_lfm, _M_sm, _M_d, _M_scx, _M_1cx, _M_c2b, _M_cb;
4982 poisson_distribution() : poisson_distribution(1.0) { }
4986 : _M_param(__mean), _M_nd()
4990 poisson_distribution(
const param_type& __p)
4991 : _M_param(__p), _M_nd()
5006 {
return _M_param.mean(); }
5013 {
return _M_param; }
5021 { _M_param = __param; }
5040 template<
typename _UniformRandomNumberGenerator>
5043 {
return this->
operator()(__urng, _M_param); }
5045 template<
typename _UniformRandomNumberGenerator>
5048 const param_type& __p);
5050 template<
typename _ForwardIterator,
5051 typename _UniformRandomNumberGenerator>
5053 __generate(_ForwardIterator __f, _ForwardIterator __t,
5054 _UniformRandomNumberGenerator& __urng)
5055 { this->__generate(__f, __t, __urng, _M_param); }
5057 template<
typename _ForwardIterator,
5058 typename _UniformRandomNumberGenerator>
5060 __generate(_ForwardIterator __f, _ForwardIterator __t,
5061 _UniformRandomNumberGenerator& __urng,
5062 const param_type& __p)
5063 { this->__generate_impl(__f, __t, __urng, __p); }
5065 template<
typename _UniformRandomNumberGenerator>
5067 __generate(result_type* __f, result_type* __t,
5068 _UniformRandomNumberGenerator& __urng,
5069 const param_type& __p)
5070 { this->__generate_impl(__f, __t, __urng, __p); }
5079 const poisson_distribution& __d2)
5080#ifdef _GLIBCXX_USE_C99_MATH_FUNCS
5081 {
return __d1._M_param == __d2._M_param && __d1._M_nd == __d2._M_nd; }
5083 {
return __d1._M_param == __d2._M_param; }
5096 template<
typename _IntType1,
typename _CharT,
typename _Traits>
5111 template<
typename _IntType1,
typename _CharT,
typename _Traits>
5117 template<
typename _ForwardIterator,
5118 typename _UniformRandomNumberGenerator>
5120 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
5121 _UniformRandomNumberGenerator& __urng,
5122 const param_type& __p);
5124 param_type _M_param;
5130#if __cpp_impl_three_way_comparison < 201907L
5134 template<
typename _IntType>
5138 {
return !(__d1 == __d2); }
5159 template<
typename _RealType =
double>
5163 "result_type must be a floating point type");
5174 param_type() : param_type(1.0) { }
5177 param_type(_RealType __lambda)
5178 : _M_lambda(__lambda)
5180 __glibcxx_assert(_M_lambda > _RealType(0));
5185 {
return _M_lambda; }
5188 operator==(
const param_type& __p1,
const param_type& __p2)
5189 {
return __p1._M_lambda == __p2._M_lambda; }
5191#if __cpp_impl_three_way_comparison < 201907L
5193 operator!=(
const param_type& __p1,
const param_type& __p2)
5194 {
return !(__p1 == __p2); }
5198 _RealType _M_lambda;
5214 : _M_param(__lambda)
5235 {
return _M_param.lambda(); }
5242 {
return _M_param; }
5250 { _M_param = __param; }
5269 template<
typename _UniformRandomNumberGenerator>
5272 {
return this->
operator()(__urng, _M_param); }
5274 template<
typename _UniformRandomNumberGenerator>
5276 operator()(_UniformRandomNumberGenerator& __urng,
5277 const param_type& __p)
5279 __detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
5284 template<
typename _ForwardIterator,
5285 typename _UniformRandomNumberGenerator>
5287 __generate(_ForwardIterator __f, _ForwardIterator __t,
5288 _UniformRandomNumberGenerator& __urng)
5289 { this->__generate(__f, __t, __urng, _M_param); }
5291 template<
typename _ForwardIterator,
5292 typename _UniformRandomNumberGenerator>
5294 __generate(_ForwardIterator __f, _ForwardIterator __t,
5295 _UniformRandomNumberGenerator& __urng,
5297 { this->__generate_impl(__f, __t, __urng, __p); }
5299 template<
typename _UniformRandomNumberGenerator>
5302 _UniformRandomNumberGenerator& __urng,
5304 { this->__generate_impl(__f, __t, __urng, __p); }
5313 {
return __d1._M_param == __d2._M_param; }
5316 template<
typename _ForwardIterator,
5317 typename _UniformRandomNumberGenerator>
5319 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
5320 _UniformRandomNumberGenerator& __urng,
5321 const param_type& __p);
5323 param_type _M_param;
5326#if __cpp_impl_three_way_comparison < 201907L
5331 template<
typename _RealType>
5335 {
return !(__d1 == __d2); }
5348 template<
typename _RealType,
typename _CharT,
typename _Traits>
5349 std::basic_ostream<_CharT, _Traits>&
5350 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
5351 const std::exponential_distribution<_RealType>& __x);
5363 template<
typename _RealType,
typename _CharT,
typename _Traits>
5364 std::basic_istream<_CharT, _Traits>&
5365 operator>>(std::basic_istream<_CharT, _Traits>& __is,
5366 std::exponential_distribution<_RealType>& __x);
5381 template<
typename _RealType =
double>
5382 class weibull_distribution
5385 "result_type must be a floating point type");
5394 typedef weibull_distribution<_RealType> distribution_type;
5396 param_type() : param_type(1.0) { }
5399 param_type(_RealType __a, _RealType __b = _RealType(1.0))
5400 : _M_a(__a), _M_b(__b)
5412 operator==(
const param_type& __p1,
const param_type& __p2)
5413 {
return __p1._M_a == __p2._M_a && __p1._M_b == __p2._M_b; }
5415#if __cpp_impl_three_way_comparison < 201907L
5417 operator!=(
const param_type& __p1,
const param_type& __p2)
5418 {
return !(__p1 == __p2); }
5426 weibull_distribution() : weibull_distribution(1.0) { }
5430 : _M_param(__a, __b)
5434 weibull_distribution(
const param_type& __p)
5450 {
return _M_param.a(); }
5457 {
return _M_param.b(); }
5464 {
return _M_param; }
5472 { _M_param = __param; }
5491 template<
typename _UniformRandomNumberGenerator>
5494 {
return this->
operator()(__urng, _M_param); }
5496 template<
typename _UniformRandomNumberGenerator>
5498 operator()(_UniformRandomNumberGenerator& __urng,
5499 const param_type& __p);
5501 template<
typename _ForwardIterator,
5502 typename _UniformRandomNumberGenerator>
5504 __generate(_ForwardIterator __f, _ForwardIterator __t,
5505 _UniformRandomNumberGenerator& __urng)
5506 { this->__generate(__f, __t, __urng, _M_param); }
5508 template<
typename _ForwardIterator,
5509 typename _UniformRandomNumberGenerator>
5511 __generate(_ForwardIterator __f, _ForwardIterator __t,
5512 _UniformRandomNumberGenerator& __urng,
5513 const param_type& __p)
5514 { this->__generate_impl(__f, __t, __urng, __p); }
5516 template<
typename _UniformRandomNumberGenerator>
5519 _UniformRandomNumberGenerator& __urng,
5521 { this->__generate_impl(__f, __t, __urng, __p); }
5529 const weibull_distribution& __d2)
5530 {
return __d1._M_param == __d2._M_param; }
5533 template<
typename _ForwardIterator,
5534 typename _UniformRandomNumberGenerator>
5536 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
5537 _UniformRandomNumberGenerator& __urng,
5538 const param_type& __p);
5540 param_type _M_param;
5543#if __cpp_impl_three_way_comparison < 201907L
5548 template<
typename _RealType>
5552 {
return !(__d1 == __d2); }
5565 template<
typename _RealType,
typename _CharT,
typename _Traits>
5566 std::basic_ostream<_CharT, _Traits>&
5567 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
5568 const std::weibull_distribution<_RealType>& __x);
5580 template<
typename _RealType,
typename _CharT,
typename _Traits>
5581 std::basic_istream<_CharT, _Traits>&
5582 operator>>(std::basic_istream<_CharT, _Traits>& __is,
5583 std::weibull_distribution<_RealType>& __x);
5598 template<
typename _RealType =
double>
5599 class extreme_value_distribution
5602 "result_type must be a floating point type");
5611 typedef extreme_value_distribution<_RealType> distribution_type;
5613 param_type() : param_type(0.0) { }
5616 param_type(_RealType __a, _RealType __b = _RealType(1.0))
5617 : _M_a(__a), _M_b(__b)
5629 operator==(
const param_type& __p1,
const param_type& __p2)
5630 {
return __p1._M_a == __p2._M_a && __p1._M_b == __p2._M_b; }
5632#if __cpp_impl_three_way_comparison < 201907L
5634 operator!=(
const param_type& __p1,
const param_type& __p2)
5635 {
return !(__p1 == __p2); }
5643 extreme_value_distribution() : extreme_value_distribution(0.0) { }
5647 : _M_param(__a, __b)
5651 extreme_value_distribution(
const param_type& __p)
5667 {
return _M_param.a(); }
5674 {
return _M_param.b(); }
5681 {
return _M_param; }
5689 { _M_param = __param; }
5708 template<
typename _UniformRandomNumberGenerator>
5711 {
return this->
operator()(__urng, _M_param); }
5713 template<
typename _UniformRandomNumberGenerator>
5715 operator()(_UniformRandomNumberGenerator& __urng,
5716 const param_type& __p);
5718 template<
typename _ForwardIterator,
5719 typename _UniformRandomNumberGenerator>
5721 __generate(_ForwardIterator __f, _ForwardIterator __t,
5722 _UniformRandomNumberGenerator& __urng)
5723 { this->__generate(__f, __t, __urng, _M_param); }
5725 template<
typename _ForwardIterator,
5726 typename _UniformRandomNumberGenerator>
5728 __generate(_ForwardIterator __f, _ForwardIterator __t,
5729 _UniformRandomNumberGenerator& __urng,
5730 const param_type& __p)
5731 { this->__generate_impl(__f, __t, __urng, __p); }
5733 template<
typename _UniformRandomNumberGenerator>
5736 _UniformRandomNumberGenerator& __urng,
5738 { this->__generate_impl(__f, __t, __urng, __p); }
5746 const extreme_value_distribution& __d2)
5747 {
return __d1._M_param == __d2._M_param; }
5750 template<
typename _ForwardIterator,
5751 typename _UniformRandomNumberGenerator>
5753 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
5754 _UniformRandomNumberGenerator& __urng,
5755 const param_type& __p);
5757 param_type _M_param;
5760#if __cpp_impl_three_way_comparison < 201907L
5765 template<
typename _RealType>
5769 {
return !(__d1 == __d2); }
5782 template<
typename _RealType,
typename _CharT,
typename _Traits>
5783 std::basic_ostream<_CharT, _Traits>&
5784 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
5785 const std::extreme_value_distribution<_RealType>& __x);
5797 template<
typename _RealType,
typename _CharT,
typename _Traits>
5798 std::basic_istream<_CharT, _Traits>&
5799 operator>>(std::basic_istream<_CharT, _Traits>& __is,
5800 std::extreme_value_distribution<_RealType>& __x);
5820 template<
typename _IntType =
int>
5821 class discrete_distribution
5824 "result_type must be an integral type");
5833 typedef discrete_distribution<_IntType> distribution_type;
5834 friend class discrete_distribution<_IntType>;
5837 : _M_prob(), _M_cp()
5840 template<
typename _InputIterator>
5841 param_type(_InputIterator __wbegin,
5842 _InputIterator __wend)
5843 : _M_prob(__wbegin, __wend), _M_cp()
5844 { _M_initialize(); }
5847 : _M_prob(__wil.begin(), __wil.end()), _M_cp()
5848 { _M_initialize(); }
5850 template<
typename _Func>
5851 param_type(
size_t __nw,
double __xmin,
double __xmax,
5855 param_type(
const param_type&) =
default;
5856 param_type& operator=(
const param_type&) =
default;
5859 probabilities()
const
5863 operator==(
const param_type& __p1,
const param_type& __p2)
5864 {
return __p1._M_prob == __p2._M_prob; }
5866#if __cpp_impl_three_way_comparison < 201907L
5868 operator!=(
const param_type& __p1,
const param_type& __p2)
5869 {
return !(__p1 == __p2); }
5880 discrete_distribution()
5884 template<
typename _InputIterator>
5886 _InputIterator __wend)
5887 : _M_param(__wbegin, __wend)
5890 discrete_distribution(initializer_list<double> __wl)
5894 template<
typename _Func>
5895 discrete_distribution(
size_t __nw,
double __xmin,
double __xmax,
5897 : _M_param(__nw, __xmin, __xmax, __fw)
5918 return _M_param._M_prob.
empty()
5927 {
return _M_param; }
5935 { _M_param = __param; }
5950 return _M_param._M_prob.empty()
5957 template<
typename _UniformRandomNumberGenerator>
5960 {
return this->
operator()(__urng, _M_param); }
5962 template<
typename _UniformRandomNumberGenerator>
5964 operator()(_UniformRandomNumberGenerator& __urng,
5965 const param_type& __p);
5967 template<
typename _ForwardIterator,
5968 typename _UniformRandomNumberGenerator>
5970 __generate(_ForwardIterator __f, _ForwardIterator __t,
5971 _UniformRandomNumberGenerator& __urng)
5972 { this->__generate(__f, __t, __urng, _M_param); }
5974 template<
typename _ForwardIterator,
5975 typename _UniformRandomNumberGenerator>
5977 __generate(_ForwardIterator __f, _ForwardIterator __t,
5978 _UniformRandomNumberGenerator& __urng,
5979 const param_type& __p)
5980 { this->__generate_impl(__f, __t, __urng, __p); }
5982 template<
typename _UniformRandomNumberGenerator>
5985 _UniformRandomNumberGenerator& __urng,
5987 { this->__generate_impl(__f, __t, __urng, __p); }
5995 const discrete_distribution& __d2)
5996 {
return __d1._M_param == __d2._M_param; }
6008 template<
typename _IntType1,
typename _CharT,
typename _Traits>
6024 template<
typename _IntType1,
typename _CharT,
typename _Traits>
6030 template<
typename _ForwardIterator,
6031 typename _UniformRandomNumberGenerator>
6033 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
6034 _UniformRandomNumberGenerator& __urng,
6035 const param_type& __p);
6037 param_type _M_param;
6040#if __cpp_impl_three_way_comparison < 201907L
6045 template<
typename _IntType>
6049 {
return !(__d1 == __d2); }
6068 template<
typename _RealType =
double>
6069 class piecewise_constant_distribution
6072 "result_type must be a floating point type");
6081 typedef piecewise_constant_distribution<_RealType> distribution_type;
6082 friend class piecewise_constant_distribution<_RealType>;
6085 : _M_int(), _M_den(), _M_cp()
6088 template<
typename _InputIteratorB,
typename _InputIteratorW>
6089 param_type(_InputIteratorB __bfirst,
6090 _InputIteratorB __bend,
6091 _InputIteratorW __wbegin);
6093 template<
typename _Func>
6096 template<
typename _Func>
6097 param_type(
size_t __nw, _RealType __xmin, _RealType __xmax,
6101 param_type(
const param_type&) =
default;
6102 param_type& operator=(
const param_type&) =
default;
6110 __tmp[1] = _RealType(1);
6122 operator==(
const param_type& __p1,
const param_type& __p2)
6123 {
return __p1._M_int == __p2._M_int && __p1._M_den == __p2._M_den; }
6125#if __cpp_impl_three_way_comparison < 201907L
6127 operator!=(
const param_type& __p1,
const param_type& __p2)
6128 {
return !(__p1 == __p2); }
6140 piecewise_constant_distribution()
6144 template<
typename _InputIteratorB,
typename _InputIteratorW>
6146 _InputIteratorB __bend,
6147 _InputIteratorW __wbegin)
6148 : _M_param(__bfirst, __bend, __wbegin)
6151 template<
typename _Func>
6152 piecewise_constant_distribution(initializer_list<_RealType> __bl,
6154 : _M_param(__bl, __fw)
6157 template<
typename _Func>
6158 piecewise_constant_distribution(
size_t __nw,
6159 _RealType __xmin, _RealType __xmax,
6161 : _M_param(__nw, __xmin, __xmax, __fw)
6165 piecewise_constant_distribution(
const param_type& __p)
6182 if (_M_param._M_int.empty())
6185 __tmp[1] = _RealType(1);
6189 return _M_param._M_int;
6198 return _M_param._M_den.
empty()
6207 {
return _M_param; }
6215 { _M_param = __param; }
6223 return _M_param._M_int.empty()
6233 return _M_param._M_int.empty()
6240 template<
typename _UniformRandomNumberGenerator>
6243 {
return this->
operator()(__urng, _M_param); }
6245 template<
typename _UniformRandomNumberGenerator>
6247 operator()(_UniformRandomNumberGenerator& __urng,
6248 const param_type& __p);
6250 template<
typename _ForwardIterator,
6251 typename _UniformRandomNumberGenerator>
6253 __generate(_ForwardIterator __f, _ForwardIterator __t,
6254 _UniformRandomNumberGenerator& __urng)
6255 { this->__generate(__f, __t, __urng, _M_param); }
6257 template<
typename _ForwardIterator,
6258 typename _UniformRandomNumberGenerator>
6260 __generate(_ForwardIterator __f, _ForwardIterator __t,
6261 _UniformRandomNumberGenerator& __urng,
6262 const param_type& __p)
6263 { this->__generate_impl(__f, __t, __urng, __p); }
6265 template<
typename _UniformRandomNumberGenerator>
6268 _UniformRandomNumberGenerator& __urng,
6270 { this->__generate_impl(__f, __t, __urng, __p); }
6278 const piecewise_constant_distribution& __d2)
6279 {
return __d1._M_param == __d2._M_param; }
6292 template<
typename _RealType1,
typename _CharT,
typename _Traits>
6308 template<
typename _RealType1,
typename _CharT,
typename _Traits>
6314 template<
typename _ForwardIterator,
6315 typename _UniformRandomNumberGenerator>
6317 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
6318 _UniformRandomNumberGenerator& __urng,
6319 const param_type& __p);
6321 param_type _M_param;
6324#if __cpp_impl_three_way_comparison < 201907L
6329 template<
typename _RealType>
6333 {
return !(__d1 == __d2); }
6348 template<
typename _RealType =
double>
6349 class piecewise_linear_distribution
6352 "result_type must be a floating point type");
6361 typedef piecewise_linear_distribution<_RealType> distribution_type;
6362 friend class piecewise_linear_distribution<_RealType>;
6365 : _M_int(), _M_den(), _M_cp(), _M_m()
6368 template<
typename _InputIteratorB,
typename _InputIteratorW>
6369 param_type(_InputIteratorB __bfirst,
6370 _InputIteratorB __bend,
6371 _InputIteratorW __wbegin);
6373 template<
typename _Func>
6376 template<
typename _Func>
6377 param_type(
size_t __nw, _RealType __xmin, _RealType __xmax,
6381 param_type(
const param_type&) =
default;
6382 param_type& operator=(
const param_type&) =
default;
6390 __tmp[1] = _RealType(1);
6402 operator==(
const param_type& __p1,
const param_type& __p2)
6403 {
return __p1._M_int == __p2._M_int && __p1._M_den == __p2._M_den; }
6405#if __cpp_impl_three_way_comparison < 201907L
6407 operator!=(
const param_type& __p1,
const param_type& __p2)
6408 {
return !(__p1 == __p2); }
6421 piecewise_linear_distribution()
6425 template<
typename _InputIteratorB,
typename _InputIteratorW>
6427 _InputIteratorB __bend,
6428 _InputIteratorW __wbegin)
6429 : _M_param(__bfirst, __bend, __wbegin)
6432 template<
typename _Func>
6433 piecewise_linear_distribution(initializer_list<_RealType> __bl,
6435 : _M_param(__bl, __fw)
6438 template<
typename _Func>
6439 piecewise_linear_distribution(
size_t __nw,
6440 _RealType __xmin, _RealType __xmax,
6442 : _M_param(__nw, __xmin, __xmax, __fw)
6446 piecewise_linear_distribution(
const param_type& __p)
6463 if (_M_param._M_int.empty())
6466 __tmp[1] = _RealType(1);
6470 return _M_param._M_int;
6480 return _M_param._M_den.
empty()
6489 {
return _M_param; }
6497 { _M_param = __param; }
6505 return _M_param._M_int.empty()
6515 return _M_param._M_int.empty()
6522 template<
typename _UniformRandomNumberGenerator>
6525 {
return this->
operator()(__urng, _M_param); }
6527 template<
typename _UniformRandomNumberGenerator>
6529 operator()(_UniformRandomNumberGenerator& __urng,
6530 const param_type& __p);
6532 template<
typename _ForwardIterator,
6533 typename _UniformRandomNumberGenerator>
6535 __generate(_ForwardIterator __f, _ForwardIterator __t,
6536 _UniformRandomNumberGenerator& __urng)
6537 { this->__generate(__f, __t, __urng, _M_param); }
6539 template<
typename _ForwardIterator,
6540 typename _UniformRandomNumberGenerator>
6542 __generate(_ForwardIterator __f, _ForwardIterator __t,
6543 _UniformRandomNumberGenerator& __urng,
6544 const param_type& __p)
6545 { this->__generate_impl(__f, __t, __urng, __p); }
6547 template<
typename _UniformRandomNumberGenerator>
6550 _UniformRandomNumberGenerator& __urng,
6552 { this->__generate_impl(__f, __t, __urng, __p); }
6560 const piecewise_linear_distribution& __d2)
6561 {
return __d1._M_param == __d2._M_param; }
6574 template<
typename _RealType1,
typename _CharT,
typename _Traits>
6590 template<
typename _RealType1,
typename _CharT,
typename _Traits>
6596 template<
typename _ForwardIterator,
6597 typename _UniformRandomNumberGenerator>
6599 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
6600 _UniformRandomNumberGenerator& __urng,
6601 const param_type& __p);
6603 param_type _M_param;
6606#if __cpp_impl_three_way_comparison < 201907L
6611 template<
typename _RealType>
6615 {
return !(__d1 == __d2); }
6646 template<
typename _IntType,
typename = _Require<is_
integral<_IntType>>>
6649 template<
typename _InputIterator>
6650 seed_seq(_InputIterator __begin, _InputIterator __end);
6653 template<
typename _RandomAccessIterator>
6655 generate(_RandomAccessIterator __begin, _RandomAccessIterator __end);
6658 size_t size() const noexcept
6659 {
return _M_v.
size(); }
6661 template<
typename _OutputIterator>
6663 param(_OutputIterator __dest)
const
6664 { std::copy(_M_v.
begin(), _M_v.
end(), __dest); }
6671 std::vector<result_type> _M_v;
6678_GLIBCXX_END_NAMESPACE_VERSION
constexpr bool operator<=(const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
constexpr duration< __common_rep_t< _Rep1, __disable_if_is_duration< _Rep2 > >, _Period > operator%(const duration< _Rep1, _Period > &__d, const _Rep2 &__s)
constexpr bool operator<(const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
constexpr complex< _Tp > operator*(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x times y.
complex< _Tp > log(const complex< _Tp > &)
Return complex natural logarithm of z.
constexpr complex< _Tp > operator+(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x plus y.
complex< _Tp > exp(const complex< _Tp > &)
Return complex base e exponential of z.
complex< _Tp > sqrt(const complex< _Tp > &)
Return complex square root of z.
auto declval() noexcept -> decltype(__declval< _Tp >(0))
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
_RealType generate_canonical(_UniformRandomNumberGenerator &__g)
A function template for converting the output of a (integral) uniform random number generator to a fl...
basic_string< char > string
A string of char.
linear_congruential_engine< uint_fast32_t, 48271UL, 0UL, 2147483647UL > minstd_rand
linear_congruential_engine< uint_fast32_t, 16807UL, 0UL, 2147483647UL > minstd_rand0
mersenne_twister_engine< uint_fast32_t, 32, 624, 397, 31, 0x9908b0dfUL, 11, 0xffffffffUL, 7, 0x9d2c5680UL, 15, 0xefc60000UL, 18, 1812433253UL > mt19937
mersenne_twister_engine< uint_fast64_t, 64, 312, 156, 31, 0xb5026f5aa96619e9ULL, 29, 0x5555555555555555ULL, 17, 0x71d67fffeda60000ULL, 37, 0xfff7eee000000000ULL, 43, 6364136223846793005ULL > mt19937_64
ISO C++ entities toplevel namespace is std.
constexpr _Tp __lg(_Tp __n)
This is a helper function for the sort routines and for random.tcc.
constexpr auto size(const _Container &__cont) noexcept(noexcept(__cont.size())) -> decltype(__cont.size())
Return the size of a container.
std::basic_istream< _CharT, _Traits > & operator>>(std::basic_istream< _CharT, _Traits > &__is, bitset< _Nb > &__x)
Global I/O operators for bitsets.
std::basic_ostream< _CharT, _Traits > & operator<<(std::basic_ostream< _CharT, _Traits > &__os, const bitset< _Nb > &__x)
Global I/O operators for bitsets.
Implementation details not part of the namespace std interface.
Template class basic_istream.
Template class basic_ostream.
static constexpr int digits
static constexpr _Tp max() noexcept
static constexpr _Tp lowest() noexcept
static constexpr _Tp min() noexcept
A model of a linear congruential random number generator.
friend std::basic_istream< _CharT, _Traits > & operator>>(std::basic_istream< _CharT, _Traits > &__is, std::linear_congruential_engine< _UIntType1, __a1, __c1, __m1 > &__lcr)
Sets the state of the engine by reading its textual representation from __is.
static constexpr result_type min()
Gets the smallest possible value in the output range.
static constexpr result_type multiplier
void discard(unsigned long long __z)
Discard a sequence of random numbers.
static constexpr result_type modulus
linear_congruential_engine()
Constructs a linear_congruential_engine random number generator engine with seed 1.
void seed(result_type __s=default_seed)
Reseeds the linear_congruential_engine random number generator engine sequence to the seed __s.
static constexpr result_type increment
friend bool operator==(const linear_congruential_engine &__lhs, const linear_congruential_engine &__rhs)
Compares two linear congruential random number generator objects of the same type for equality.
friend std::basic_ostream< _CharT, _Traits > & operator<<(std::basic_ostream< _CharT, _Traits > &__os, const std::linear_congruential_engine< _UIntType1, __a1, __c1, __m1 > &__lcr)
Writes the textual representation of the state x(i) of x to __os.
result_type operator()()
Gets the next random number in the sequence.
static constexpr result_type max()
Gets the largest possible value in the output range.
void discard(unsigned long long __z)
Discard a sequence of random numbers.
friend std::basic_istream< _CharT, _Traits > & operator>>(std::basic_istream< _CharT, _Traits > &__is, std::mersenne_twister_engine< _UIntType1, __w1, __n1, __m1, __r1, __a1, __u1, __d1, __s1, __b1, __t1, __c1, __l1, __f1 > &__x)
Extracts the current state of a % mersenne_twister_engine random number generator engine __x from the...
static constexpr result_type max()
Gets the largest possible value in the output range.
friend bool operator==(const mersenne_twister_engine &__lhs, const mersenne_twister_engine &__rhs)
Compares two % mersenne_twister_engine random number generator objects of the same type for equality.
friend std::basic_ostream< _CharT, _Traits > & operator<<(std::basic_ostream< _CharT, _Traits > &__os, const std::mersenne_twister_engine< _UIntType1, __w1, __n1, __m1, __r1, __a1, __u1, __d1, __s1, __b1, __t1, __c1, __l1, __f1 > &__x)
Inserts the current state of a % mersenne_twister_engine random number generator engine __x into the ...
static constexpr result_type min()
Gets the smallest possible value in the output range.
The Marsaglia-Zaman generator.
void seed(result_type __sd=0u)
Seeds the initial state of the random number generator.
friend std::basic_ostream< _CharT, _Traits > & operator<<(std::basic_ostream< _CharT, _Traits > &__os, const std::subtract_with_carry_engine< _UIntType1, __w1, __s1, __r1 > &__x)
Inserts the current state of a % subtract_with_carry_engine random number generator engine __x into t...
void discard(unsigned long long __z)
Discard a sequence of random numbers.
result_type operator()()
Gets the next random number in the sequence.
static constexpr result_type min()
Gets the inclusive minimum value of the range of random integers returned by this generator.
friend std::basic_istream< _CharT, _Traits > & operator>>(std::basic_istream< _CharT, _Traits > &__is, std::subtract_with_carry_engine< _UIntType1, __w1, __s1, __r1 > &__x)
Extracts the current state of a % subtract_with_carry_engine random number generator engine __x from ...
friend bool operator==(const subtract_with_carry_engine &__lhs, const subtract_with_carry_engine &__rhs)
Compares two % subtract_with_carry_engine random number generator objects of the same type for equali...
static constexpr result_type max()
Gets the inclusive maximum value of the range of random integers returned by this generator.
static constexpr result_type min()
Gets the minimum value in the generated random number range.
friend std::basic_ostream< _CharT, _Traits > & operator<<(std::basic_ostream< _CharT, _Traits > &__os, const std::discard_block_engine< _RandomNumberEngine1, __p1, __r1 > &__x)
Inserts the current state of a discard_block_engine random number generator engine __x into the outpu...
const _RandomNumberEngine & base() const noexcept
Gets a const reference to the underlying generator engine object.
void seed()
Reseeds the discard_block_engine object with the default seed for the underlying base class generator...
void discard(unsigned long long __z)
Discard a sequence of random numbers.
friend std::basic_istream< _CharT, _Traits > & operator>>(std::basic_istream< _CharT, _Traits > &__is, std::discard_block_engine< _RandomNumberEngine1, __p1, __r1 > &__x)
Extracts the current state of a % subtract_with_carry_engine random number generator engine __x from ...
static constexpr result_type max()
Gets the maximum value in the generated random number range.
discard_block_engine()
Constructs a default discard_block_engine engine.
friend bool operator==(const discard_block_engine &__lhs, const discard_block_engine &__rhs)
Compares two discard_block_engine random number generator objects of the same type for equality.
result_type operator()()
Gets the next value in the generated random number sequence.
_RandomNumberEngine::result_type result_type
static constexpr result_type min()
Gets the minimum value in the generated random number range.
result_type operator()()
Gets the next value in the generated random number sequence.
void seed()
Reseeds the independent_bits_engine object with the default seed for the underlying base class genera...
void discard(unsigned long long __z)
Discard a sequence of random numbers.
friend std::basic_istream< _CharT, _Traits > & operator>>(std::basic_istream< _CharT, _Traits > &__is, std::independent_bits_engine< _RandomNumberEngine, __w, _UIntType > &__x)
Extracts the current state of a % subtract_with_carry_engine random number generator engine __x from ...
friend bool operator==(const independent_bits_engine &__lhs, const independent_bits_engine &__rhs)
Compares two independent_bits_engine random number generator objects of the same type for equality.
static constexpr result_type max()
Gets the maximum value in the generated random number range.
independent_bits_engine()
Constructs a default independent_bits_engine engine.
const _RandomNumberEngine & base() const noexcept
Gets a const reference to the underlying generator engine object.
Produces random numbers by reordering random numbers from some base engine.
static constexpr result_type min()
shuffle_order_engine()
Constructs a default shuffle_order_engine engine.
static constexpr result_type max()
const _RandomNumberEngine & base() const noexcept
void seed()
Reseeds the shuffle_order_engine object with the default seed for the underlying base class generator...
_RandomNumberEngine::result_type result_type
friend bool operator==(const shuffle_order_engine &__lhs, const shuffle_order_engine &__rhs)
void discard(unsigned long long __z)
friend std::basic_ostream< _CharT, _Traits > & operator<<(std::basic_ostream< _CharT, _Traits > &__os, const std::shuffle_order_engine< _RandomNumberEngine1, __k1 > &__x)
Inserts the current state of a shuffle_order_engine random number generator engine __x into the outpu...
friend std::basic_istream< _CharT, _Traits > & operator>>(std::basic_istream< _CharT, _Traits > &__is, std::shuffle_order_engine< _RandomNumberEngine1, __k1 > &__x)
Extracts the current state of a % subtract_with_carry_engine random number generator engine __x from ...
Uniform continuous distribution for random numbers.
param_type param() const
Returns the parameter set of the distribution.
void reset()
Resets the distribution state.
uniform_real_distribution(_RealType __a, _RealType __b=_RealType(1))
Constructs a uniform_real_distribution object.
result_type min() const
Returns the inclusive lower bound of the distribution range.
friend bool operator==(const uniform_real_distribution &__d1, const uniform_real_distribution &__d2)
Return true if two uniform real distributions have the same parameters.
result_type max() const
Returns the inclusive upper bound of the distribution range.
uniform_real_distribution()
Constructs a uniform_real_distribution object.
result_type operator()(_UniformRandomNumberGenerator &__urng)
Generating functions.
void param(const param_type &__param)
Sets the parameter set of the distribution.
A normal continuous distribution for random numbers.
result_type operator()(_UniformRandomNumberGenerator &__urng, const param_type &__p)
_RealType stddev() const
Returns the standard deviation of the distribution.
param_type param() const
Returns the parameter set of the distribution.
void reset()
Resets the distribution state.
friend std::basic_istream< _CharT, _Traits > & operator>>(std::basic_istream< _CharT, _Traits > &__is, std::normal_distribution< _RealType1 > &__x)
Extracts a normal_distribution random number distribution __x from the input stream __is.
void param(const param_type &__param)
Sets the parameter set of the distribution.
result_type min() const
Returns the greatest lower bound value of the distribution.
_RealType mean() const
Returns the mean of the distribution.
friend std::basic_ostream< _CharT, _Traits > & operator<<(std::basic_ostream< _CharT, _Traits > &__os, const std::normal_distribution< _RealType1 > &__x)
Inserts a normal_distribution random number distribution __x into the output stream __os.
normal_distribution(result_type __mean, result_type __stddev=result_type(1))
result_type max() const
Returns the least upper bound value of the distribution.
result_type operator()(_UniformRandomNumberGenerator &__urng)
Generating functions.
friend bool operator==(const std::normal_distribution< _RealType1 > &__d1, const std::normal_distribution< _RealType1 > &__d2)
Return true if two normal distributions have the same parameters and the sequences that would be gene...
A lognormal_distribution random number distribution.
friend bool operator==(const lognormal_distribution &__d1, const lognormal_distribution &__d2)
Return true if two lognormal distributions have the same parameters and the sequences that would be g...
param_type param() const
Returns the parameter set of the distribution.
friend std::basic_istream< _CharT, _Traits > & operator>>(std::basic_istream< _CharT, _Traits > &__is, std::lognormal_distribution< _RealType1 > &__x)
Extracts a lognormal_distribution random number distribution __x from the input stream __is.
result_type min() const
Returns the greatest lower bound value of the distribution.
friend std::basic_ostream< _CharT, _Traits > & operator<<(std::basic_ostream< _CharT, _Traits > &__os, const std::lognormal_distribution< _RealType1 > &__x)
Inserts a lognormal_distribution random number distribution __x into the output stream __os.
void param(const param_type &__param)
Sets the parameter set of the distribution.
result_type max() const
Returns the least upper bound value of the distribution.
result_type operator()(_UniformRandomNumberGenerator &__urng)
Generating functions.
A gamma continuous distribution for random numbers.
result_type operator()(_UniformRandomNumberGenerator &__urng, const param_type &__p)
gamma_distribution(_RealType __alpha_val, _RealType __beta_val=_RealType(1))
Constructs a gamma distribution with parameters and .
void reset()
Resets the distribution state.
friend std::basic_ostream< _CharT, _Traits > & operator<<(std::basic_ostream< _CharT, _Traits > &__os, const std::gamma_distribution< _RealType1 > &__x)
Inserts a gamma_distribution random number distribution __x into the output stream __os.
result_type operator()(_UniformRandomNumberGenerator &__urng)
Generating functions.
result_type min() const
Returns the greatest lower bound value of the distribution.
_RealType alpha() const
Returns the of the distribution.
gamma_distribution()
Constructs a gamma distribution with parameters 1 and 1.
friend bool operator==(const gamma_distribution &__d1, const gamma_distribution &__d2)
Return true if two gamma distributions have the same parameters and the sequences that would be gener...
void param(const param_type &__param)
Sets the parameter set of the distribution.
_RealType beta() const
Returns the of the distribution.
friend std::basic_istream< _CharT, _Traits > & operator>>(std::basic_istream< _CharT, _Traits > &__is, std::gamma_distribution< _RealType1 > &__x)
Extracts a gamma_distribution random number distribution __x from the input stream __is.
param_type param() const
Returns the parameter set of the distribution.
result_type max() const
Returns the least upper bound value of the distribution.
A chi_squared_distribution random number distribution.
result_type operator()(_UniformRandomNumberGenerator &__urng)
Generating functions.
param_type param() const
Returns the parameter set of the distribution.
friend bool operator==(const chi_squared_distribution &__d1, const chi_squared_distribution &__d2)
Return true if two Chi-squared distributions have the same parameters and the sequences that would be...
result_type min() const
Returns the greatest lower bound value of the distribution.
friend std::basic_ostream< _CharT, _Traits > & operator<<(std::basic_ostream< _CharT, _Traits > &__os, const std::chi_squared_distribution< _RealType1 > &__x)
Inserts a chi_squared_distribution random number distribution __x into the output stream __os.
void reset()
Resets the distribution state.
void param(const param_type &__param)
Sets the parameter set of the distribution.
result_type max() const
Returns the least upper bound value of the distribution.
friend std::basic_istream< _CharT, _Traits > & operator>>(std::basic_istream< _CharT, _Traits > &__is, std::chi_squared_distribution< _RealType1 > &__x)
Extracts a chi_squared_distribution random number distribution __x from the input stream __is.
A cauchy_distribution random number distribution.
result_type min() const
Returns the greatest lower bound value of the distribution.
friend bool operator==(const cauchy_distribution &__d1, const cauchy_distribution &__d2)
Return true if two Cauchy distributions have the same parameters.
void reset()
Resets the distribution state.
param_type param() const
Returns the parameter set of the distribution.
result_type operator()(_UniformRandomNumberGenerator &__urng)
Generating functions.
result_type max() const
Returns the least upper bound value of the distribution.
void param(const param_type &__param)
Sets the parameter set of the distribution.
A fisher_f_distribution random number distribution.
void param(const param_type &__param)
Sets the parameter set of the distribution.
result_type max() const
Returns the least upper bound value of the distribution.
void reset()
Resets the distribution state.
param_type param() const
Returns the parameter set of the distribution.
friend bool operator==(const fisher_f_distribution &__d1, const fisher_f_distribution &__d2)
Return true if two Fisher f distributions have the same parameters and the sequences that would be ge...
result_type min() const
Returns the greatest lower bound value of the distribution.
result_type operator()(_UniformRandomNumberGenerator &__urng)
Generating functions.
friend std::basic_ostream< _CharT, _Traits > & operator<<(std::basic_ostream< _CharT, _Traits > &__os, const std::fisher_f_distribution< _RealType1 > &__x)
Inserts a fisher_f_distribution random number distribution __x into the output stream __os.
friend std::basic_istream< _CharT, _Traits > & operator>>(std::basic_istream< _CharT, _Traits > &__is, std::fisher_f_distribution< _RealType1 > &__x)
Extracts a fisher_f_distribution random number distribution __x from the input stream __is.
A student_t_distribution random number distribution.
void param(const param_type &__param)
Sets the parameter set of the distribution.
result_type max() const
Returns the least upper bound value of the distribution.
result_type min() const
Returns the greatest lower bound value of the distribution.
void reset()
Resets the distribution state.
friend bool operator==(const student_t_distribution &__d1, const student_t_distribution &__d2)
Return true if two Student t distributions have the same parameters and the sequences that would be g...
result_type operator()(_UniformRandomNumberGenerator &__urng)
Generating functions.
friend std::basic_ostream< _CharT, _Traits > & operator<<(std::basic_ostream< _CharT, _Traits > &__os, const std::student_t_distribution< _RealType1 > &__x)
Inserts a student_t_distribution random number distribution __x into the output stream __os.
friend std::basic_istream< _CharT, _Traits > & operator>>(std::basic_istream< _CharT, _Traits > &__is, std::student_t_distribution< _RealType1 > &__x)
Extracts a student_t_distribution random number distribution __x from the input stream __is.
param_type param() const
Returns the parameter set of the distribution.
A Bernoulli random number distribution.
void reset()
Resets the distribution state.
result_type max() const
Returns the least upper bound value of the distribution.
friend bool operator==(const bernoulli_distribution &__d1, const bernoulli_distribution &__d2)
Return true if two Bernoulli distributions have the same parameters.
param_type param() const
Returns the parameter set of the distribution.
bernoulli_distribution()
Constructs a Bernoulli distribution with likelihood 0.5.
bernoulli_distribution(double __p)
Constructs a Bernoulli distribution with likelihood p.
result_type min() const
Returns the greatest lower bound value of the distribution.
double p() const
Returns the p parameter of the distribution.
void param(const param_type &__param)
Sets the parameter set of the distribution.
result_type operator()(_UniformRandomNumberGenerator &__urng)
Generating functions.
A discrete binomial random number distribution.
result_type min() const
Returns the greatest lower bound value of the distribution.
result_type max() const
Returns the least upper bound value of the distribution.
void param(const param_type &__param)
Sets the parameter set of the distribution.
result_type operator()(_UniformRandomNumberGenerator &__urng)
Generating functions.
friend bool operator==(const binomial_distribution &__d1, const binomial_distribution &__d2)
Return true if two binomial distributions have the same parameters and the sequences that would be ge...
param_type param() const
Returns the parameter set of the distribution.
friend std::basic_istream< _CharT, _Traits > & operator>>(std::basic_istream< _CharT, _Traits > &__is, std::binomial_distribution< _IntType1 > &__x)
Extracts a binomial_distribution random number distribution __x from the input stream __is.
_IntType t() const
Returns the distribution t parameter.
friend std::basic_ostream< _CharT, _Traits > & operator<<(std::basic_ostream< _CharT, _Traits > &__os, const std::binomial_distribution< _IntType1 > &__x)
Inserts a binomial_distribution random number distribution __x into the output stream __os.
void reset()
Resets the distribution state.
double p() const
Returns the distribution p parameter.
result_type operator()(_UniformRandomNumberGenerator &__urng, const param_type &__p)
A discrete geometric random number distribution.
double p() const
Returns the distribution parameter p.
result_type operator()(_UniformRandomNumberGenerator &__urng)
Generating functions.
result_type max() const
Returns the least upper bound value of the distribution.
friend bool operator==(const geometric_distribution &__d1, const geometric_distribution &__d2)
Return true if two geometric distributions have the same parameters.
param_type param() const
Returns the parameter set of the distribution.
void param(const param_type &__param)
Sets the parameter set of the distribution.
void reset()
Resets the distribution state.
result_type min() const
Returns the greatest lower bound value of the distribution.
A negative_binomial_distribution random number distribution.
friend std::basic_ostream< _CharT, _Traits > & operator<<(std::basic_ostream< _CharT, _Traits > &__os, const std::negative_binomial_distribution< _IntType1 > &__x)
Inserts a negative_binomial_distribution random number distribution __x into the output stream __os.
result_type operator()(_UniformRandomNumberGenerator &__urng)
Generating functions.
friend std::basic_istream< _CharT, _Traits > & operator>>(std::basic_istream< _CharT, _Traits > &__is, std::negative_binomial_distribution< _IntType1 > &__x)
Extracts a negative_binomial_distribution random number distribution __x from the input stream __is.
void param(const param_type &__param)
Sets the parameter set of the distribution.
result_type min() const
Returns the greatest lower bound value of the distribution.
result_type max() const
Returns the least upper bound value of the distribution.
double p() const
Return the parameter of the distribution.
friend bool operator==(const negative_binomial_distribution &__d1, const negative_binomial_distribution &__d2)
Return true if two negative binomial distributions have the same parameters and the sequences that wo...
param_type param() const
Returns the parameter set of the distribution.
_IntType k() const
Return the parameter of the distribution.
void reset()
Resets the distribution state.
A discrete Poisson random number distribution.
result_type operator()(_UniformRandomNumberGenerator &__urng, const param_type &__p)
void reset()
Resets the distribution state.
result_type operator()(_UniformRandomNumberGenerator &__urng)
Generating functions.
double mean() const
Returns the distribution parameter mean.
friend bool operator==(const poisson_distribution &__d1, const poisson_distribution &__d2)
Return true if two Poisson distributions have the same parameters and the sequences that would be gen...
result_type max() const
Returns the least upper bound value of the distribution.
void param(const param_type &__param)
Sets the parameter set of the distribution.
friend std::basic_ostream< _CharT, _Traits > & operator<<(std::basic_ostream< _CharT, _Traits > &__os, const std::poisson_distribution< _IntType1 > &__x)
Inserts a poisson_distribution random number distribution __x into the output stream __os.
param_type param() const
Returns the parameter set of the distribution.
friend std::basic_istream< _CharT, _Traits > & operator>>(std::basic_istream< _CharT, _Traits > &__is, std::poisson_distribution< _IntType1 > &__x)
Extracts a poisson_distribution random number distribution __x from the input stream __is.
result_type min() const
Returns the greatest lower bound value of the distribution.
An exponential continuous distribution for random numbers.
_RealType lambda() const
Returns the inverse scale parameter of the distribution.
exponential_distribution()
Constructs an exponential distribution with inverse scale parameter 1.0.
exponential_distribution(_RealType __lambda)
Constructs an exponential distribution with inverse scale parameter .
result_type operator()(_UniformRandomNumberGenerator &__urng)
Generating functions.
void reset()
Resets the distribution state.
result_type min() const
Returns the greatest lower bound value of the distribution.
param_type param() const
Returns the parameter set of the distribution.
result_type max() const
Returns the least upper bound value of the distribution.
void param(const param_type &__param)
Sets the parameter set of the distribution.
friend bool operator==(const exponential_distribution &__d1, const exponential_distribution &__d2)
Return true if two exponential distributions have the same parameters.
A weibull_distribution random number distribution.
param_type param() const
Returns the parameter set of the distribution.
result_type min() const
Returns the greatest lower bound value of the distribution.
void reset()
Resets the distribution state.
result_type operator()(_UniformRandomNumberGenerator &__urng)
Generating functions.
friend bool operator==(const weibull_distribution &__d1, const weibull_distribution &__d2)
Return true if two Weibull distributions have the same parameters.
void param(const param_type &__param)
Sets the parameter set of the distribution.
_RealType b() const
Return the parameter of the distribution.
result_type max() const
Returns the least upper bound value of the distribution.
_RealType a() const
Return the parameter of the distribution.
A extreme_value_distribution random number distribution.
void reset()
Resets the distribution state.
_RealType b() const
Return the parameter of the distribution.
result_type operator()(_UniformRandomNumberGenerator &__urng)
Generating functions.
void param(const param_type &__param)
Sets the parameter set of the distribution.
result_type min() const
Returns the greatest lower bound value of the distribution.
result_type max() const
Returns the least upper bound value of the distribution.
_RealType a() const
Return the parameter of the distribution.
friend bool operator==(const extreme_value_distribution &__d1, const extreme_value_distribution &__d2)
Return true if two extreme value distributions have the same parameters.
param_type param() const
Returns the parameter set of the distribution.
A discrete_distribution random number distribution.
friend std::basic_ostream< _CharT, _Traits > & operator<<(std::basic_ostream< _CharT, _Traits > &__os, const std::discrete_distribution< _IntType1 > &__x)
Inserts a discrete_distribution random number distribution __x into the output stream __os.
result_type min() const
Returns the greatest lower bound value of the distribution.
friend std::basic_istream< _CharT, _Traits > & operator>>(std::basic_istream< _CharT, _Traits > &__is, std::discrete_distribution< _IntType1 > &__x)
Extracts a discrete_distribution random number distribution __x from the input stream __is.
result_type max() const
Returns the least upper bound value of the distribution.
void reset()
Resets the distribution state.
param_type param() const
Returns the parameter set of the distribution.
friend bool operator==(const discrete_distribution &__d1, const discrete_distribution &__d2)
Return true if two discrete distributions have the same parameters.
std::vector< double > probabilities() const
Returns the probabilities of the distribution.
result_type operator()(_UniformRandomNumberGenerator &__urng)
Generating functions.
void param(const param_type &__param)
Sets the parameter set of the distribution.
A piecewise_constant_distribution random number distribution.
std::vector< double > densities() const
Returns a vector of the probability densities.
void param(const param_type &__param)
Sets the parameter set of the distribution.
result_type min() const
Returns the greatest lower bound value of the distribution.
result_type max() const
Returns the least upper bound value of the distribution.
void reset()
Resets the distribution state.
friend std::basic_ostream< _CharT, _Traits > & operator<<(std::basic_ostream< _CharT, _Traits > &__os, const std::piecewise_constant_distribution< _RealType1 > &__x)
Inserts a piecewise_constant_distribution random number distribution __x into the output stream __os.
param_type param() const
Returns the parameter set of the distribution.
friend bool operator==(const piecewise_constant_distribution &__d1, const piecewise_constant_distribution &__d2)
Return true if two piecewise constant distributions have the same parameters.
result_type operator()(_UniformRandomNumberGenerator &__urng)
Generating functions.
friend std::basic_istream< _CharT, _Traits > & operator>>(std::basic_istream< _CharT, _Traits > &__is, std::piecewise_constant_distribution< _RealType1 > &__x)
Extracts a piecewise_constant_distribution random number distribution __x from the input stream __is.
std::vector< _RealType > intervals() const
Returns a vector of the intervals.
A piecewise_linear_distribution random number distribution.
result_type operator()(_UniformRandomNumberGenerator &__urng)
Generating functions.
result_type max() const
Returns the least upper bound value of the distribution.
friend std::basic_istream< _CharT, _Traits > & operator>>(std::basic_istream< _CharT, _Traits > &__is, std::piecewise_linear_distribution< _RealType1 > &__x)
Extracts a piecewise_linear_distribution random number distribution __x from the input stream __is.
std::vector< _RealType > intervals() const
Return the intervals of the distribution.
param_type param() const
Returns the parameter set of the distribution.
friend bool operator==(const piecewise_linear_distribution &__d1, const piecewise_linear_distribution &__d2)
Return true if two piecewise linear distributions have the same parameters.
void param(const param_type &__param)
Sets the parameter set of the distribution.
result_type min() const
Returns the greatest lower bound value of the distribution.
std::vector< double > densities() const
Return a vector of the probability densities of the distribution.
friend std::basic_ostream< _CharT, _Traits > & operator<<(std::basic_ostream< _CharT, _Traits > &__os, const std::piecewise_linear_distribution< _RealType1 > &__x)
Inserts a piecewise_linear_distribution random number distribution __x into the output stream __os.
uint_least32_t result_type
A standard container which offers fixed time access to individual elements in any order.
constexpr iterator end() noexcept
constexpr iterator begin() noexcept
constexpr bool empty() const noexcept
constexpr size_type size() const noexcept