38namespace std _GLIBCXX_VISIBILITY(default)
40_GLIBCXX_BEGIN_NAMESPACE_VERSION
54#ifndef _GLIBCXX_USE_OLD_GENERATE_CANONICAL
55_GLIBCXX_BEGIN_INLINE_ABI_NAMESPACE(_V2)
62 template<
typename _RealType,
size_t __bits,
63 typename _UniformRandomNumberGenerator>
66#ifndef _GLIBCXX_USE_OLD_GENERATE_CANONICAL
67_GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
74#pragma GCC diagnostic push
75#pragma GCC diagnostic ignored "-Wc++17-extensions"
77 template<
typename _UIntType,
size_t __w,
78 bool = __w < static_cast<size_t>
81 {
static constexpr _UIntType __value = 0; };
83 template<
typename _UIntType,
size_t __w>
84 struct _Shift<_UIntType, __w, true>
85 {
static constexpr _UIntType __value = _UIntType(1) << __w; };
88 int __which = ((__s <= __CHAR_BIT__ *
sizeof (int))
89 + (__s <= __CHAR_BIT__ *
sizeof (long))
90 + (__s <= __CHAR_BIT__ *
sizeof (
long long))
93 struct _Select_uint_least_t
95 static_assert(__which < 0,
96 "sorry, would be too much trouble for a slow result");
100 struct _Select_uint_least_t<__s, 4>
101 {
using type =
unsigned int; };
104 struct _Select_uint_least_t<__s, 3>
105 {
using type =
unsigned long; };
108 struct _Select_uint_least_t<__s, 2>
109 {
using type =
unsigned long long; };
111#if __SIZEOF_INT128__ > __SIZEOF_LONG_LONG__
113 struct _Select_uint_least_t<__s, 1>
114 { __extension__
using type =
unsigned __int128; };
115#elif __has_builtin(__builtin_add_overflow) \
116 && __has_builtin(__builtin_sub_overflow) \
117 && defined __UINT64_TYPE__
119 struct _Select_uint_least_t<__s, 1>
126 type(uint64_t __a) noexcept : _M_lo(__a), _M_hi(0) { }
130 operator*(type __l, uint64_t __x)
noexcept
136 constexpr uint64_t __mask = 0xffffffff;
137 uint64_t __ll[2] = { __l._M_lo >> 32, __l._M_lo & __mask };
138 uint64_t __xx[2] = { __x >> 32, __x & __mask };
139 uint64_t __l0x0 = __ll[0] * __xx[0];
140 uint64_t __l0x1 = __ll[0] * __xx[1];
141 uint64_t __l1x0 = __ll[1] * __xx[0];
142 uint64_t __l1x1 = __ll[1] * __xx[1];
146 = (__l0x1 & __mask) + (__l1x0 & __mask) + (__l1x1 >> 32);
147 __l._M_hi = __l0x0 + (__l0x1 >> 32) + (__l1x0 >> 32) + (__mid >> 32);
148 __l._M_lo = (__mid << 32) + (__l1x1 & __mask);
153 operator+(type __l, uint64_t __c)
noexcept
155 __l._M_hi += __builtin_add_overflow(__l._M_lo, __c, &__l._M_lo);
160 operator%(type __l, uint64_t __m)
noexcept
162 if (__builtin_expect(__l._M_hi == 0, 0))
168 int __shift = __builtin_clzll(__m) + 64
169 - __builtin_clzll(__l._M_hi);
173 __x._M_hi = __m << (__shift - 64);
178 __x._M_hi = __m >> (64 - __shift);
179 __x._M_lo = __m << __shift;
182 while (__l._M_hi != 0 || __l._M_lo >= __m)
186 __l._M_hi -= __x._M_hi;
187 __l._M_hi -= __builtin_sub_overflow(__l._M_lo, __x._M_lo,
190 __x._M_lo = (__x._M_lo >> 1) | (__x._M_hi << 63);
197 explicit operator uint64_t() const noexcept
200 friend bool operator<(
const type& __l,
const type& __r)
noexcept
202 if (__l._M_hi < __r._M_hi)
204 else if (__l._M_hi == __r._M_hi)
205 return __l._M_lo < __r._M_lo;
210 friend bool operator<=(
const type& __l,
const type& __r)
noexcept
211 {
return !(__r < __l); }
220 template<
typename _Tp, _Tp __m, _Tp __a, _Tp __c,
221 bool __big_enough = (!(__m & (__m - 1))
222 || (_Tp(-1) - __c) / __a >= __m - 1),
223 bool __schrage_ok = __m % __a < __m / __a>
230 =
typename _Select_uint_least_t<
std::__lg(__a)
232 return static_cast<_Tp
>((_Tp2(__a) * __x + __c) % __m);
237 template<
typename _Tp, _Tp __m, _Tp __a, _Tp __c>
238 struct _Mod<_Tp, __m, __a, __c, false, true>
247 template<
typename _Tp, _Tp __m, _Tp __a, _Tp __c,
bool __s>
248 struct _Mod<_Tp, __m, __a, __c, true, __s>
253 _Tp __res = __a * __x + __c;
260 template<
typename _Tp, _Tp __m, _Tp __a = 1, _Tp __c = 0>
264 if constexpr (__a == 0)
267 return _Mod<_Tp, __m, __a, __c>::__calc(__x);
274 template<
typename _Engine,
typename _DInputType>
277 static_assert(std::is_floating_point<_DInputType>::value,
278 "template argument must be a floating point type");
281 _Adaptor(_Engine& __g)
286 {
return _DInputType(0); }
290 {
return _DInputType(1); }
314 template<
typename _Sseq>
315 using __seed_seq_generate_t =
decltype(
319 template<
typename _Sseq,
typename _Engine,
typename _Res,
320 typename _GenerateCheck = __seed_seq_generate_t<_Sseq>>
321 using _If_seed_seq_for = _Require<
322 __not_<is_same<__remove_cvref_t<_Sseq>, _Engine>>,
323 is_unsigned<typename _Sseq::result_type>,
324 __not_<is_convertible<_Sseq, _Res>>
327#pragma GCC diagnostic pop
372 template<
typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
376 "result_type must be an unsigned integral type");
377 static_assert(__m == 0u || (__a < __m && __c < __m),
378 "template argument substituting __m out of bounds");
380 template<
typename _Sseq>
421 template<
typename _Sseq,
typename = _If_seed_seq<_Sseq>>
442 template<
typename _Sseq>
454 {
return __c == 0u ? 1u : 0u; }
467 discard(
unsigned long long __z)
469 for (; __z != 0ULL; --__z)
479 _M_x = __detail::__mod<_UIntType, __m, __a, __c>(_M_x);
497 {
return __lhs._M_x == __rhs._M_x; }
507 template<
typename _UIntType1, _UIntType1 __a1, _UIntType1 __c1,
508 _UIntType1 __m1,
typename _CharT,
typename _Traits>
512 __a1, __c1, __m1>& __lcr);
527 template<
typename _UIntType1, _UIntType1 __a1, _UIntType1 __c1,
528 _UIntType1 __m1,
typename _CharT,
typename _Traits>
538#if __cpp_impl_three_way_comparison < 201907L
550 template<
typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
556 {
return !(__lhs == __rhs); }
590 template<
typename _UIntType,
size_t __w,
591 size_t __n,
size_t __m,
size_t __r,
592 _UIntType __a,
size_t __u, _UIntType __d,
size_t __s,
593 _UIntType __b,
size_t __t,
594 _UIntType __c,
size_t __l, _UIntType __f>
595 class mersenne_twister_engine
598 "result_type must be an unsigned integral type");
599 static_assert(1u <= __m && __m <= __n,
600 "template argument substituting __m out of bounds");
601 static_assert(__r <= __w,
"template argument substituting "
603 static_assert(__u <= __w,
"template argument substituting "
605 static_assert(__s <= __w,
"template argument substituting "
607 static_assert(__t <= __w,
"template argument substituting "
609 static_assert(__l <= __w,
"template argument substituting "
611 static_assert(__w <= std::numeric_limits<_UIntType>::digits,
612 "template argument substituting __w out of bound");
613 static_assert(__a <= (__detail::_Shift<_UIntType, __w>::__value - 1),
614 "template argument substituting __a out of bound");
615 static_assert(__b <= (__detail::_Shift<_UIntType, __w>::__value - 1),
616 "template argument substituting __b out of bound");
617 static_assert(__c <= (__detail::_Shift<_UIntType, __w>::__value - 1),
618 "template argument substituting __c out of bound");
619 static_assert(__d <= (__detail::_Shift<_UIntType, __w>::__value - 1),
620 "template argument substituting __d out of bound");
621 static_assert(__f <= (__detail::_Shift<_UIntType, __w>::__value - 1),
622 "template argument substituting __f out of bound");
624 template<
typename _Sseq>
626 = __detail::_If_seed_seq_for<_Sseq, mersenne_twister_engine,
634 static constexpr size_t word_size = __w;
635 static constexpr size_t state_size = __n;
636 static constexpr size_t shift_size = __m;
637 static constexpr size_t mask_bits = __r;
639 static constexpr size_t tempering_u = __u;
641 static constexpr size_t tempering_s = __s;
643 static constexpr size_t tempering_t = __t;
645 static constexpr size_t tempering_l = __l;
646 static constexpr result_type initialization_multiplier = __f;
651 mersenne_twister_engine() : mersenne_twister_engine(default_seed) { }
663 template<
typename _Sseq,
typename = _If_seed_seq<_Sseq>>
665 mersenne_twister_engine(_Sseq& __q)
669 seed(result_type __sd = default_seed);
671 template<
typename _Sseq>
687 {
return __detail::_Shift<_UIntType, __w>::__value - 1; }
693 discard(
unsigned long long __z);
711 operator==(
const mersenne_twister_engine& __lhs,
712 const mersenne_twister_engine& __rhs)
713 {
return (std::equal(__lhs._M_x, __lhs._M_x + state_size, __rhs._M_x)
714 && __lhs._M_p == __rhs._M_p); }
728 template<
typename _UIntType1,
729 size_t __w1,
size_t __n1,
730 size_t __m1,
size_t __r1,
731 _UIntType1 __a1,
size_t __u1,
732 _UIntType1 __d1,
size_t __s1,
733 _UIntType1 __b1,
size_t __t1,
734 _UIntType1 __c1,
size_t __l1, _UIntType1 __f1,
735 typename _CharT,
typename _Traits>
739 __m1, __r1, __a1, __u1, __d1, __s1, __b1, __t1, __c1,
754 template<
typename _UIntType1,
755 size_t __w1,
size_t __n1,
756 size_t __m1,
size_t __r1,
757 _UIntType1 __a1,
size_t __u1,
758 _UIntType1 __d1,
size_t __s1,
759 _UIntType1 __b1,
size_t __t1,
760 _UIntType1 __c1,
size_t __l1, _UIntType1 __f1,
761 typename _CharT,
typename _Traits>
765 __r1, __a1, __u1, __d1, __s1, __b1, __t1, __c1,
771 _UIntType _M_x[state_size];
775#if __cpp_impl_three_way_comparison < 201907L
788 template<
typename _UIntType,
size_t __w,
789 size_t __n,
size_t __m,
size_t __r,
790 _UIntType __a,
size_t __u, _UIntType __d,
size_t __s,
791 _UIntType __b,
size_t __t,
792 _UIntType __c,
size_t __l, _UIntType __f>
795 __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>& __lhs,
797 __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>& __rhs)
798 {
return !(__lhs == __rhs); }
819 template<
typename _UIntType,
size_t __w,
size_t __s,
size_t __r>
820 class subtract_with_carry_engine
823 "result_type must be an unsigned integral type");
824 static_assert(0u < __s && __s < __r,
826 static_assert(0u < __w && __w <= std::numeric_limits<_UIntType>::digits,
827 "template argument substituting __w out of bounds");
829 template<
typename _Sseq>
831 = __detail::_If_seed_seq_for<_Sseq, subtract_with_carry_engine,
839 static constexpr size_t word_size = __w;
840 static constexpr size_t short_lag = __s;
841 static constexpr size_t long_lag = __r;
842 static constexpr uint_least32_t default_seed = 19780503u;
844 subtract_with_carry_engine() : subtract_with_carry_engine(0u)
861 template<
typename _Sseq,
typename = _If_seed_seq<_Sseq>>
863 subtract_with_carry_engine(_Sseq& __q)
885 template<
typename _Sseq>
903 {
return __detail::_Shift<_UIntType, __w>::__value - 1; }
909 discard(
unsigned long long __z)
911 for (; __z != 0ULL; --__z)
934 operator==(
const subtract_with_carry_engine& __lhs,
935 const subtract_with_carry_engine& __rhs)
936 {
return (std::equal(__lhs._M_x, __lhs._M_x + long_lag, __rhs._M_x)
937 && __lhs._M_carry == __rhs._M_carry
938 && __lhs._M_p == __rhs._M_p); }
952 template<
typename _UIntType1,
size_t __w1,
size_t __s1,
size_t __r1,
953 typename _CharT,
typename _Traits>
971 template<
typename _UIntType1,
size_t __w1,
size_t __s1,
size_t __r1,
972 typename _CharT,
typename _Traits>
980 _UIntType _M_x[long_lag];
985#if __cpp_impl_three_way_comparison < 201907L
998 template<
typename _UIntType,
size_t __w,
size_t __s,
size_t __r>
1004 {
return !(__lhs == __rhs); }
1016 template<
typename _RandomNumberEngine,
size_t __p,
size_t __r>
1019 static_assert(1 <= __r && __r <= __p,
1020 "template argument substituting __r out of bounds");
1026 template<
typename _Sseq>
1032 static constexpr size_t block_size = __p;
1033 static constexpr size_t used_block = __r;
1041 : _M_b(), _M_n(0) { }
1051 : _M_b(__rng), _M_n(0) { }
1061 : _M_b(
std::
move(__rng)), _M_n(0) { }
1071 : _M_b(__s), _M_n(0) { }
1078 template<
typename _Sseq,
typename = _If_seed_seq<_Sseq>>
1081 : _M_b(__q), _M_n(0)
1111 template<
typename _Sseq>
1123 const _RandomNumberEngine&
1124 base() const noexcept
1132 {
return _RandomNumberEngine::min(); }
1139 {
return _RandomNumberEngine::max(); }
1145 discard(
unsigned long long __z)
1147 for (; __z != 0ULL; --__z)
1171 {
return __lhs._M_b == __rhs._M_b && __lhs._M_n == __rhs._M_n; }
1184 template<
typename _RandomNumberEngine1,
size_t __p1,
size_t __r1,
1185 typename _CharT,
typename _Traits>
1202 template<
typename _RandomNumberEngine1,
size_t __p1,
size_t __r1,
1203 typename _CharT,
typename _Traits>
1210 _RandomNumberEngine _M_b;
1214#if __cpp_impl_three_way_comparison < 201907L
1226 template<
typename _RandomNumberEngine,
size_t __p,
size_t __r>
1232 {
return !(__lhs == __rhs); }
1242 template<
typename _RandomNumberEngine,
size_t __w,
typename _UIntType>
1246 "result_type must be an unsigned integral type");
1247 static_assert(0u < __w && __w <= std::numeric_limits<_UIntType>::digits,
1248 "template argument substituting __w out of bounds");
1250 template<
typename _Sseq>
1302 template<
typename _Sseq,
typename = _If_seed_seq<_Sseq>>
1329 template<
typename _Sseq>
1338 const _RandomNumberEngine&
1339 base() const noexcept
1354 {
return __detail::_Shift<_UIntType, __w>::__value - 1; }
1360 discard(
unsigned long long __z)
1362 for (; __z != 0ULL; --__z)
1387 {
return __lhs._M_b == __rhs._M_b; }
1401 template<
typename _CharT,
typename _Traits>
1405 __w, _UIntType>& __x)
1412 _RandomNumberEngine _M_b;
1415#if __cpp_impl_three_way_comparison < 201907L
1428 template<
typename _RandomNumberEngine,
size_t __w,
typename _UIntType>
1434 {
return !(__lhs == __rhs); }
1447 template<
typename _RandomNumberEngine,
size_t __w,
typename _UIntType,
1448 typename _CharT,
typename _Traits>
1449 std::basic_ostream<_CharT, _Traits>&
1450 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
1451 const std::independent_bits_engine<_RandomNumberEngine,
1452 __w, _UIntType>& __x)
1469 template<
typename _RandomNumberEngine,
size_t __k>
1472 static_assert(1u <= __k,
"template argument substituting "
1473 "__k out of bound");
1479 template<
typename _Sseq>
1484 static constexpr size_t table_size = __k;
1493 { _M_initialize(); }
1504 { _M_initialize(); }
1515 { _M_initialize(); }
1526 { _M_initialize(); }
1533 template<
typename _Sseq,
typename = _If_seed_seq<_Sseq>>
1537 { _M_initialize(); }
1566 template<
typename _Sseq>
1577 const _RandomNumberEngine&
1578 base() const noexcept
1586 {
return _RandomNumberEngine::min(); }
1593 {
return _RandomNumberEngine::max(); }
1599 discard(
unsigned long long __z)
1601 for (; __z != 0ULL; --__z)
1625 {
return (__lhs._M_b == __rhs._M_b
1626 && std::equal(__lhs._M_v, __lhs._M_v + __k, __rhs._M_v)
1627 && __lhs._M_y == __rhs._M_y); }
1640 template<
typename _RandomNumberEngine1,
size_t __k1,
1641 typename _CharT,
typename _Traits>
1658 template<
typename _RandomNumberEngine1,
size_t __k1,
1659 typename _CharT,
typename _Traits>
1665 void _M_initialize()
1667 for (
size_t __i = 0; __i < __k; ++__i)
1672 _RandomNumberEngine _M_b;
1673 result_type _M_v[__k];
1677#if __cpp_impl_three_way_comparison < 201907L
1689 template<
typename _RandomNumberEngine,
size_t __k>
1695 {
return !(__lhs == __rhs); }
1698#if __glibcxx_philox_engine
1727 template<
typename _UIntType,
size_t __w,
size_t __n,
size_t __r,
1728 _UIntType... __consts>
1731 static_assert(__n == 2 || __n == 4,
1732 "template argument N must be either 2 or 4");
1733 static_assert(
sizeof...(__consts) == __n,
1734 "length of consts array must match specified N");
1735 static_assert(0 < __r,
"a number of rounds must be specified");
1736 static_assert((0 < __w && __w <= numeric_limits<_UIntType>::digits),
1737 "specified bitlength must match input type");
1739 template<
typename _Sseq>
1740 static constexpr bool __is_seed_seq =
requires {
1741 typename __detail::_If_seed_seq_for<_Sseq, philox_engine, _UIntType>;
1744 template <
size_t __ind0,
size_t __ind1>
1746 array<_UIntType, __n / 2>
1749 if constexpr (__n == 4)
1750 return {__consts...[__ind0], __consts...[__ind1]};
1752 return {__consts...[__ind0]};
1756 using result_type = _UIntType;
1758 static constexpr size_t word_size = __w;
1759 static constexpr size_t word_count = __n;
1760 static constexpr size_t round_count = __r;
1761 static constexpr array<result_type, __n / 2> multipliers
1762 = _S_popArray<0,2>();
1763 static constexpr array<result_type, __n / 2> round_consts
1764 = _S_popArray<1,3>();
1767 static constexpr result_type
1772 static constexpr result_type
1775 return ((1ull << (__w - 1)) | ((1ull << (__w - 1)) - 1));
1778 static constexpr result_type default_seed = 20111115u;
1782 : philox_engine(default_seed)
1786 philox_engine(result_type __value)
1787 : _M_x{}, _M_k{}, _M_y{}, _M_i(__n - 1)
1788 { _M_k[0] = __value & max(); }
1794 template<
typename _Sseq>
requires __is_seed_seq<_Sseq>
1796 philox_engine(_Sseq& __q)
1802 seed(result_type __value = default_seed)
1807 _M_k[0] = __value & max();
1815 template<
typename _Sseq>
1817 seed(_Sseq& __q)
requires __is_seed_seq<_Sseq>;
1824 set_counter(
const array<result_type, __n>& __counter)
1826 for (
size_t __j = 0; __j < __n; ++__j)
1827 _M_x[__j] = __counter[__n - 1 - __j] & max();
1837 operator==(
const philox_engine&,
const philox_engine&) =
default;
1855 discard(
unsigned long long __z)
1868 template<
typename _CharT,
typename _Traits>
1869 friend basic_ostream<_CharT, _Traits>&
1870 operator<<(basic_ostream<_CharT, _Traits>& __os,
1871 const philox_engine& __x)
1873 const typename ios_base::fmtflags __flags = __os.flags();
1874 const _CharT __fill = __os.fill();
1875 __os.flags(ios_base::dec | ios_base::left);
1876 _CharT __space = __os.widen(
' ');
1878 for (
auto& __subkey : __x._M_k)
1879 __os << __subkey << __space;
1880 for (
auto& __ctr : __x._M_x)
1881 __os << __ctr << __space;
1883 __os.flags(__flags);
1895 template <
typename _CharT,
typename _Traits>
1896 friend basic_istream<_CharT, _Traits>&
1897 operator>>(basic_istream<_CharT, _Traits>& __is,
1900 const typename ios_base::fmtflags __flags = __is.flags();
1901 __is.flags(ios_base::dec | ios_base::skipws);
1902 for (
auto& __subkey : __x._M_k)
1904 for (
auto& __ctr : __x._M_x)
1906 array<_UIntType, __n> __tmpCtr = __x._M_x;
1907 unsigned char __setIndex = 0;
1908 for (
size_t __j = 0; __j < __x._M_x.size(); ++__j)
1910 if (__x._M_x[__j] > 0)
1916 for (
size_t __j = 0; __j <= __setIndex; ++__j)
1918 if (__j != __setIndex)
1919 __x._M_x[__j] = max();
1924 __x._M_x = __tmpCtr;
1926 __is.flags(__flags);
1932 array<_UIntType, __n> _M_x;
1933 array<_UIntType, __n / 2> _M_k;
1934 array<_UIntType, __n> _M_y;
1935 unsigned long long _M_i = 0;
1939 _S_mulhi(_UIntType __a, _UIntType __b);
1943 _S_mullo(_UIntType __a, _UIntType __b);
1989 0xb5026f5aa96619e9ULL, 29,
1990 0x5555555555555555ULL, 17,
1991 0x71d67fffeda60000ULL, 37,
1992 0xfff7eee000000000ULL, 43,
2009#if __glibcxx_philox_engine
2012 typedef philox_engine<
2015 0xCD9E8D57, 0x9E3779B9,
2016 0xD2511F53, 0xBB67AE85> philox4x32;
2019 typedef philox_engine<
2022 0xCA5A826395121157, 0x9E3779B97F4A7C15,
2023 0xD2E7470EE14C6C93, 0xBB67AE8584CAA73B> philox4x64;
2041 random_device() { _M_init(
"default"); }
2058 entropy() const noexcept
2059 {
return this->_M_getentropy(); }
2063 {
return this->_M_getval(); }
2066 random_device(
const random_device&) =
delete;
2067 void operator=(
const random_device&) =
delete;
2077 double _M_getentropy() const noexcept;
2079 void _M_init(const
char*,
size_t);
2109#if __cpp_impl_three_way_comparison < 201907L
2114 template<
typename _IntType>
2116 operator!=(
const std::uniform_int_distribution<_IntType>& __d1,
2117 const std::uniform_int_distribution<_IntType>& __d2)
2118 {
return !(__d1 == __d2); }
2131 template<
typename _IntType,
typename _CharT,
typename _Traits>
2132 std::basic_ostream<_CharT, _Traits>&
2133 operator<<(std::basic_ostream<_CharT, _Traits>&,
2134 const std::uniform_int_distribution<_IntType>&);
2145 template<
typename _IntType,
typename _CharT,
typename _Traits>
2146 std::basic_istream<_CharT, _Traits>&
2147 operator>>(std::basic_istream<_CharT, _Traits>&,
2148 std::uniform_int_distribution<_IntType>&);
2161 template<
typename _RealType =
double>
2165 "result_type must be a floating point type");
2176 param_type() : param_type(0) { }
2179 param_type(_RealType __a, _RealType __b = _RealType(1))
2180 : _M_a(__a), _M_b(__b)
2182 __glibcxx_assert(_M_a <= _M_b);
2194 operator==(
const param_type& __p1,
const param_type& __p2)
2195 {
return __p1._M_a == __p2._M_a && __p1._M_b == __p2._M_b; }
2197#if __cpp_impl_three_way_comparison < 201907L
2199 operator!=(
const param_type& __p1,
const param_type& __p2)
2200 {
return !(__p1 == __p2); }
2224 : _M_param(__a, __b)
2242 {
return _M_param.a(); }
2246 {
return _M_param.b(); }
2253 {
return _M_param; }
2261 { _M_param = __param; }
2268 {
return this->a(); }
2275 {
return this->b(); }
2280 template<
typename _UniformRandomNumberGenerator>
2283 {
return this->
operator()(__urng, _M_param); }
2285 template<
typename _UniformRandomNumberGenerator>
2287 operator()(_UniformRandomNumberGenerator& __urng,
2288 const param_type& __p)
2290 __detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
2292 return (__aurng() * (__p.b() - __p.a())) + __p.a();
2295 template<
typename _ForwardIterator,
2296 typename _UniformRandomNumberGenerator>
2298 __generate(_ForwardIterator __f, _ForwardIterator __t,
2299 _UniformRandomNumberGenerator& __urng)
2300 { this->__generate(__f, __t, __urng, _M_param); }
2302 template<
typename _ForwardIterator,
2303 typename _UniformRandomNumberGenerator>
2305 __generate(_ForwardIterator __f, _ForwardIterator __t,
2306 _UniformRandomNumberGenerator& __urng,
2308 { this->__generate_impl(__f, __t, __urng, __p); }
2310 template<
typename _UniformRandomNumberGenerator>
2313 _UniformRandomNumberGenerator& __urng,
2315 { this->__generate_impl(__f, __t, __urng, __p); }
2324 {
return __d1._M_param == __d2._M_param; }
2327 template<
typename _ForwardIterator,
2328 typename _UniformRandomNumberGenerator>
2330 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
2331 _UniformRandomNumberGenerator& __urng,
2332 const param_type& __p);
2334 param_type _M_param;
2337#if __cpp_impl_three_way_comparison < 201907L
2342 template<
typename _IntType>
2346 {
return !(__d1 == __d2); }
2359 template<
typename _RealType,
typename _CharT,
typename _Traits>
2360 std::basic_ostream<_CharT, _Traits>&
2361 operator<<(std::basic_ostream<_CharT, _Traits>&,
2362 const std::uniform_real_distribution<_RealType>&);
2373 template<
typename _RealType,
typename _CharT,
typename _Traits>
2374 std::basic_istream<_CharT, _Traits>&
2375 operator>>(std::basic_istream<_CharT, _Traits>&,
2376 std::uniform_real_distribution<_RealType>&);
2398 template<
typename _RealType =
double>
2399 class normal_distribution
2402 "result_type must be a floating point type");
2411 typedef normal_distribution<_RealType> distribution_type;
2413 param_type() : param_type(0.0) { }
2416 param_type(_RealType __mean, _RealType __stddev = _RealType(1))
2417 : _M_mean(__mean), _M_stddev(__stddev)
2419 __glibcxx_assert(_M_stddev > _RealType(0));
2428 {
return _M_stddev; }
2431 operator==(
const param_type& __p1,
const param_type& __p2)
2432 {
return (__p1._M_mean == __p2._M_mean
2433 && __p1._M_stddev == __p2._M_stddev); }
2435#if __cpp_impl_three_way_comparison < 201907L
2437 operator!=(
const param_type& __p1,
const param_type& __p2)
2438 {
return !(__p1 == __p2); }
2443 _RealType _M_stddev;
2447 normal_distribution() : normal_distribution(0.0) { }
2456 : _M_param(__mean, __stddev)
2469 { _M_saved_available =
false; }
2476 {
return _M_param.mean(); }
2483 {
return _M_param.stddev(); }
2490 {
return _M_param; }
2498 { _M_param = __param; }
2517 template<
typename _UniformRandomNumberGenerator>
2520 {
return this->
operator()(__urng, _M_param); }
2522 template<
typename _UniformRandomNumberGenerator>
2525 const param_type& __p);
2527 template<
typename _ForwardIterator,
2528 typename _UniformRandomNumberGenerator>
2530 __generate(_ForwardIterator __f, _ForwardIterator __t,
2531 _UniformRandomNumberGenerator& __urng)
2532 { this->__generate(__f, __t, __urng, _M_param); }
2534 template<
typename _ForwardIterator,
2535 typename _UniformRandomNumberGenerator>
2537 __generate(_ForwardIterator __f, _ForwardIterator __t,
2538 _UniformRandomNumberGenerator& __urng,
2539 const param_type& __p)
2540 { this->__generate_impl(__f, __t, __urng, __p); }
2542 template<
typename _UniformRandomNumberGenerator>
2544 __generate(result_type* __f, result_type* __t,
2545 _UniformRandomNumberGenerator& __urng,
2546 const param_type& __p)
2547 { this->__generate_impl(__f, __t, __urng, __p); }
2554 template<
typename _RealType1>
2569 template<
typename _RealType1,
typename _CharT,
typename _Traits>
2584 template<
typename _RealType1,
typename _CharT,
typename _Traits>
2590 template<
typename _ForwardIterator,
2591 typename _UniformRandomNumberGenerator>
2593 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
2594 _UniformRandomNumberGenerator& __urng,
2595 const param_type& __p);
2597 param_type _M_param;
2599 bool _M_saved_available =
false;
2602#if __cpp_impl_three_way_comparison < 201907L
2606 template<
typename _RealType>
2610 {
return !(__d1 == __d2); }
2625 template<
typename _RealType =
double>
2626 class lognormal_distribution
2629 "result_type must be a floating point type");
2638 typedef lognormal_distribution<_RealType> distribution_type;
2640 param_type() : param_type(0.0) { }
2643 param_type(_RealType __m, _RealType __s = _RealType(1))
2644 : _M_m(__m), _M_s(__s)
2656 operator==(
const param_type& __p1,
const param_type& __p2)
2657 {
return __p1._M_m == __p2._M_m && __p1._M_s == __p2._M_s; }
2659#if __cpp_impl_three_way_comparison < 201907L
2661 operator!=(
const param_type& __p1,
const param_type& __p2)
2662 {
return !(__p1 == __p2); }
2670 lognormal_distribution() : lognormal_distribution(0.0) { }
2674 : _M_param(__m, __s), _M_nd()
2678 lognormal_distribution(
const param_type& __p)
2679 : _M_param(__p), _M_nd()
2694 {
return _M_param.m(); }
2698 {
return _M_param.s(); }
2705 {
return _M_param; }
2713 { _M_param = __param; }
2732 template<
typename _UniformRandomNumberGenerator>
2735 {
return this->
operator()(__urng, _M_param); }
2737 template<
typename _UniformRandomNumberGenerator>
2739 operator()(_UniformRandomNumberGenerator& __urng,
2740 const param_type& __p)
2741 {
return std::exp(__p.s() * _M_nd(__urng) + __p.m()); }
2743 template<
typename _ForwardIterator,
2744 typename _UniformRandomNumberGenerator>
2746 __generate(_ForwardIterator __f, _ForwardIterator __t,
2747 _UniformRandomNumberGenerator& __urng)
2748 { this->__generate(__f, __t, __urng, _M_param); }
2750 template<
typename _ForwardIterator,
2751 typename _UniformRandomNumberGenerator>
2753 __generate(_ForwardIterator __f, _ForwardIterator __t,
2754 _UniformRandomNumberGenerator& __urng,
2756 { this->__generate_impl(__f, __t, __urng, __p); }
2758 template<
typename _UniformRandomNumberGenerator>
2761 _UniformRandomNumberGenerator& __urng,
2763 { this->__generate_impl(__f, __t, __urng, __p); }
2772 const lognormal_distribution& __d2)
2773 {
return (__d1._M_param == __d2._M_param
2774 && __d1._M_nd == __d2._M_nd); }
2786 template<
typename _RealType1,
typename _CharT,
typename _Traits>
2801 template<
typename _RealType1,
typename _CharT,
typename _Traits>
2807 template<
typename _ForwardIterator,
2808 typename _UniformRandomNumberGenerator>
2810 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
2811 _UniformRandomNumberGenerator& __urng,
2812 const param_type& __p);
2814 param_type _M_param;
2819#if __cpp_impl_three_way_comparison < 201907L
2823 template<
typename _RealType>
2827 {
return !(__d1 == __d2); }
2850 template<
typename _RealType =
double>
2854 "result_type must be a floating point type");
2866 param_type() : param_type(1.0) { }
2869 param_type(_RealType __alpha_val, _RealType __beta_val = _RealType(1))
2870 : _M_alpha(__alpha_val), _M_beta(__beta_val)
2872 __glibcxx_assert(_M_alpha > _RealType(0));
2878 {
return _M_alpha; }
2885 operator==(
const param_type& __p1,
const param_type& __p2)
2886 {
return (__p1._M_alpha == __p2._M_alpha
2887 && __p1._M_beta == __p2._M_beta); }
2889#if __cpp_impl_three_way_comparison < 201907L
2891 operator!=(
const param_type& __p1,
const param_type& __p2)
2892 {
return !(__p1 == __p2); }
2902 _RealType _M_malpha, _M_a2;
2917 _RealType __beta_val = _RealType(1))
2918 : _M_param(__alpha_val, __beta_val), _M_nd()
2923 : _M_param(__p), _M_nd()
2938 {
return _M_param.alpha(); }
2945 {
return _M_param.beta(); }
2952 {
return _M_param; }
2960 { _M_param = __param; }
2979 template<
typename _UniformRandomNumberGenerator>
2982 {
return this->
operator()(__urng, _M_param); }
2984 template<
typename _UniformRandomNumberGenerator>
2987 const param_type& __p);
2989 template<
typename _ForwardIterator,
2990 typename _UniformRandomNumberGenerator>
2992 __generate(_ForwardIterator __f, _ForwardIterator __t,
2993 _UniformRandomNumberGenerator& __urng)
2994 { this->__generate(__f, __t, __urng, _M_param); }
2996 template<
typename _ForwardIterator,
2997 typename _UniformRandomNumberGenerator>
2999 __generate(_ForwardIterator __f, _ForwardIterator __t,
3000 _UniformRandomNumberGenerator& __urng,
3001 const param_type& __p)
3002 { this->__generate_impl(__f, __t, __urng, __p); }
3004 template<
typename _UniformRandomNumberGenerator>
3006 __generate(result_type* __f, result_type* __t,
3007 _UniformRandomNumberGenerator& __urng,
3008 const param_type& __p)
3009 { this->__generate_impl(__f, __t, __urng, __p); }
3019 {
return (__d1._M_param == __d2._M_param
3020 && __d1._M_nd == __d2._M_nd); }
3032 template<
typename _RealType1,
typename _CharT,
typename _Traits>
3046 template<
typename _RealType1,
typename _CharT,
typename _Traits>
3052 template<
typename _ForwardIterator,
3053 typename _UniformRandomNumberGenerator>
3055 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
3056 _UniformRandomNumberGenerator& __urng,
3057 const param_type& __p);
3059 param_type _M_param;
3064#if __cpp_impl_three_way_comparison < 201907L
3068 template<
typename _RealType>
3072 {
return !(__d1 == __d2); }
3092 template<
typename _RealType =
double>
3093 class chi_squared_distribution
3096 "result_type must be a floating point type");
3105 typedef chi_squared_distribution<_RealType> distribution_type;
3107 param_type() : param_type(1) { }
3110 param_type(_RealType __n)
3119 operator==(
const param_type& __p1,
const param_type& __p2)
3120 {
return __p1._M_n == __p2._M_n; }
3122#if __cpp_impl_three_way_comparison < 201907L
3124 operator!=(
const param_type& __p1,
const param_type& __p2)
3125 {
return !(__p1 == __p2); }
3132 chi_squared_distribution() : chi_squared_distribution(1) { }
3136 : _M_param(__n), _M_gd(__n / 2)
3140 chi_squared_distribution(
const param_type& __p)
3141 : _M_param(__p), _M_gd(__p.n() / 2)
3156 {
return _M_param.n(); }
3163 {
return _M_param; }
3175 _M_gd.param(param_type{__param.n() / 2});
3195 template<
typename _UniformRandomNumberGenerator>
3198 {
return 2 * _M_gd(__urng); }
3200 template<
typename _UniformRandomNumberGenerator>
3202 operator()(_UniformRandomNumberGenerator& __urng,
3203 const param_type& __p)
3207 return 2 * _M_gd(__urng, param_type(__p.n() / 2));
3210 template<
typename _ForwardIterator,
3211 typename _UniformRandomNumberGenerator>
3213 __generate(_ForwardIterator __f, _ForwardIterator __t,
3214 _UniformRandomNumberGenerator& __urng)
3215 { this->__generate_impl(__f, __t, __urng); }
3217 template<
typename _ForwardIterator,
3218 typename _UniformRandomNumberGenerator>
3220 __generate(_ForwardIterator __f, _ForwardIterator __t,
3221 _UniformRandomNumberGenerator& __urng,
3223 {
typename std::gamma_distribution<result_type>::param_type
3225 this->__generate_impl(__f, __t, __urng, __p2); }
3227 template<
typename _UniformRandomNumberGenerator>
3230 _UniformRandomNumberGenerator& __urng)
3231 { this->__generate_impl(__f, __t, __urng); }
3233 template<
typename _UniformRandomNumberGenerator>
3236 _UniformRandomNumberGenerator& __urng,
3238 {
typename std::gamma_distribution<result_type>::param_type
3240 this->__generate_impl(__f, __t, __urng, __p2); }
3249 const chi_squared_distribution& __d2)
3250 {
return __d1._M_param == __d2._M_param && __d1._M_gd == __d2._M_gd; }
3262 template<
typename _RealType1,
typename _CharT,
typename _Traits>
3277 template<
typename _RealType1,
typename _CharT,
typename _Traits>
3283 template<
typename _ForwardIterator,
3284 typename _UniformRandomNumberGenerator>
3286 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
3287 _UniformRandomNumberGenerator& __urng);
3289 template<
typename _ForwardIterator,
3290 typename _UniformRandomNumberGenerator>
3292 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
3293 _UniformRandomNumberGenerator& __urng,
3297 param_type _M_param;
3302#if __cpp_impl_three_way_comparison < 201907L
3306 template<
typename _RealType>
3310 {
return !(__d1 == __d2); }
3322 template<
typename _RealType =
double>
3323 class cauchy_distribution
3326 "result_type must be a floating point type");
3335 typedef cauchy_distribution<_RealType> distribution_type;
3337 param_type() : param_type(0) { }
3340 param_type(_RealType __a, _RealType __b = _RealType(1))
3341 : _M_a(__a), _M_b(__b)
3353 operator==(
const param_type& __p1,
const param_type& __p2)
3354 {
return __p1._M_a == __p2._M_a && __p1._M_b == __p2._M_b; }
3356#if __cpp_impl_three_way_comparison < 201907L
3358 operator!=(
const param_type& __p1,
const param_type& __p2)
3359 {
return !(__p1 == __p2); }
3367 cauchy_distribution() : cauchy_distribution(0.0) { }
3371 : _M_param(__a, __b)
3375 cauchy_distribution(
const param_type& __p)
3391 {
return _M_param.a(); }
3395 {
return _M_param.b(); }
3402 {
return _M_param; }
3410 { _M_param = __param; }
3429 template<
typename _UniformRandomNumberGenerator>
3432 {
return this->
operator()(__urng, _M_param); }
3434 template<
typename _UniformRandomNumberGenerator>
3436 operator()(_UniformRandomNumberGenerator& __urng,
3437 const param_type& __p);
3439 template<
typename _ForwardIterator,
3440 typename _UniformRandomNumberGenerator>
3442 __generate(_ForwardIterator __f, _ForwardIterator __t,
3443 _UniformRandomNumberGenerator& __urng)
3444 { this->__generate(__f, __t, __urng, _M_param); }
3446 template<
typename _ForwardIterator,
3447 typename _UniformRandomNumberGenerator>
3449 __generate(_ForwardIterator __f, _ForwardIterator __t,
3450 _UniformRandomNumberGenerator& __urng,
3451 const param_type& __p)
3452 { this->__generate_impl(__f, __t, __urng, __p); }
3454 template<
typename _UniformRandomNumberGenerator>
3457 _UniformRandomNumberGenerator& __urng,
3459 { this->__generate_impl(__f, __t, __urng, __p); }
3467 const cauchy_distribution& __d2)
3468 {
return __d1._M_param == __d2._M_param; }
3471 template<
typename _ForwardIterator,
3472 typename _UniformRandomNumberGenerator>
3474 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
3475 _UniformRandomNumberGenerator& __urng,
3476 const param_type& __p);
3478 param_type _M_param;
3481#if __cpp_impl_three_way_comparison < 201907L
3486 template<
typename _RealType>
3490 {
return !(__d1 == __d2); }
3503 template<
typename _RealType,
typename _CharT,
typename _Traits>
3504 std::basic_ostream<_CharT, _Traits>&
3505 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
3506 const std::cauchy_distribution<_RealType>& __x);
3518 template<
typename _RealType,
typename _CharT,
typename _Traits>
3519 std::basic_istream<_CharT, _Traits>&
3520 operator>>(std::basic_istream<_CharT, _Traits>& __is,
3521 std::cauchy_distribution<_RealType>& __x);
3537 template<
typename _RealType =
double>
3538 class fisher_f_distribution
3541 "result_type must be a floating point type");
3550 typedef fisher_f_distribution<_RealType> distribution_type;
3552 param_type() : param_type(1) { }
3555 param_type(_RealType __m, _RealType __n = _RealType(1))
3556 : _M_m(__m), _M_n(__n)
3568 operator==(
const param_type& __p1,
const param_type& __p2)
3569 {
return __p1._M_m == __p2._M_m && __p1._M_n == __p2._M_n; }
3571#if __cpp_impl_three_way_comparison < 201907L
3573 operator!=(
const param_type& __p1,
const param_type& __p2)
3574 {
return !(__p1 == __p2); }
3582 fisher_f_distribution() : fisher_f_distribution(1.0) { }
3586 _RealType __n = _RealType(1))
3587 : _M_param(__m, __n), _M_gd_x(__m / 2), _M_gd_y(__n / 2)
3591 fisher_f_distribution(
const param_type& __p)
3592 : _M_param(__p), _M_gd_x(__p.m() / 2), _M_gd_y(__p.n() / 2)
3610 {
return _M_param.m(); }
3614 {
return _M_param.n(); }
3621 {
return _M_param; }
3629 { _M_param = __param; }
3648 template<
typename _UniformRandomNumberGenerator>
3651 {
return (_M_gd_x(__urng) * n()) / (_M_gd_y(__urng) * m()); }
3653 template<
typename _UniformRandomNumberGenerator>
3655 operator()(_UniformRandomNumberGenerator& __urng,
3656 const param_type& __p)
3660 return ((_M_gd_x(__urng, param_type(__p.m() / 2)) * n())
3661 / (_M_gd_y(__urng, param_type(__p.n() / 2)) * m()));
3664 template<
typename _ForwardIterator,
3665 typename _UniformRandomNumberGenerator>
3667 __generate(_ForwardIterator __f, _ForwardIterator __t,
3668 _UniformRandomNumberGenerator& __urng)
3669 { this->__generate_impl(__f, __t, __urng); }
3671 template<
typename _ForwardIterator,
3672 typename _UniformRandomNumberGenerator>
3674 __generate(_ForwardIterator __f, _ForwardIterator __t,
3675 _UniformRandomNumberGenerator& __urng,
3677 { this->__generate_impl(__f, __t, __urng, __p); }
3679 template<
typename _UniformRandomNumberGenerator>
3682 _UniformRandomNumberGenerator& __urng)
3683 { this->__generate_impl(__f, __t, __urng); }
3685 template<
typename _UniformRandomNumberGenerator>
3688 _UniformRandomNumberGenerator& __urng,
3690 { this->__generate_impl(__f, __t, __urng, __p); }
3699 const fisher_f_distribution& __d2)
3700 {
return (__d1._M_param == __d2._M_param
3701 && __d1._M_gd_x == __d2._M_gd_x
3702 && __d1._M_gd_y == __d2._M_gd_y); }
3714 template<
typename _RealType1,
typename _CharT,
typename _Traits>
3729 template<
typename _RealType1,
typename _CharT,
typename _Traits>
3735 template<
typename _ForwardIterator,
3736 typename _UniformRandomNumberGenerator>
3738 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
3739 _UniformRandomNumberGenerator& __urng);
3741 template<
typename _ForwardIterator,
3742 typename _UniformRandomNumberGenerator>
3744 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
3745 _UniformRandomNumberGenerator& __urng,
3746 const param_type& __p);
3748 param_type _M_param;
3753#if __cpp_impl_three_way_comparison < 201907L
3757 template<
typename _RealType>
3761 {
return !(__d1 == __d2); }
3776 template<
typename _RealType =
double>
3777 class student_t_distribution
3780 "result_type must be a floating point type");
3789 typedef student_t_distribution<_RealType> distribution_type;
3791 param_type() : param_type(1) { }
3794 param_type(_RealType __n)
3803 operator==(
const param_type& __p1,
const param_type& __p2)
3804 {
return __p1._M_n == __p2._M_n; }
3806#if __cpp_impl_three_way_comparison < 201907L
3808 operator!=(
const param_type& __p1,
const param_type& __p2)
3809 {
return !(__p1 == __p2); }
3816 student_t_distribution() : student_t_distribution(1.0) { }
3820 : _M_param(__n), _M_nd(), _M_gd(__n / 2, 2)
3824 student_t_distribution(
const param_type& __p)
3825 : _M_param(__p), _M_nd(), _M_gd(__p.n() / 2, 2)
3843 {
return _M_param.n(); }
3850 {
return _M_param; }
3858 { _M_param = __param; }
3877 template<
typename _UniformRandomNumberGenerator>
3880 {
return _M_nd(__urng) *
std::sqrt(n() / _M_gd(__urng)); }
3882 template<
typename _UniformRandomNumberGenerator>
3884 operator()(_UniformRandomNumberGenerator& __urng,
3885 const param_type& __p)
3890 const result_type __g = _M_gd(__urng, param_type(__p.n() / 2, 2));
3891 return _M_nd(__urng) *
std::sqrt(__p.n() / __g);
3894 template<
typename _ForwardIterator,
3895 typename _UniformRandomNumberGenerator>
3897 __generate(_ForwardIterator __f, _ForwardIterator __t,
3898 _UniformRandomNumberGenerator& __urng)
3899 { this->__generate_impl(__f, __t, __urng); }
3901 template<
typename _ForwardIterator,
3902 typename _UniformRandomNumberGenerator>
3904 __generate(_ForwardIterator __f, _ForwardIterator __t,
3905 _UniformRandomNumberGenerator& __urng,
3907 { this->__generate_impl(__f, __t, __urng, __p); }
3909 template<
typename _UniformRandomNumberGenerator>
3912 _UniformRandomNumberGenerator& __urng)
3913 { this->__generate_impl(__f, __t, __urng); }
3915 template<
typename _UniformRandomNumberGenerator>
3918 _UniformRandomNumberGenerator& __urng,
3920 { this->__generate_impl(__f, __t, __urng, __p); }
3929 const student_t_distribution& __d2)
3930 {
return (__d1._M_param == __d2._M_param
3931 && __d1._M_nd == __d2._M_nd && __d1._M_gd == __d2._M_gd); }
3943 template<
typename _RealType1,
typename _CharT,
typename _Traits>
3958 template<
typename _RealType1,
typename _CharT,
typename _Traits>
3964 template<
typename _ForwardIterator,
3965 typename _UniformRandomNumberGenerator>
3967 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
3968 _UniformRandomNumberGenerator& __urng);
3969 template<
typename _ForwardIterator,
3970 typename _UniformRandomNumberGenerator>
3972 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
3973 _UniformRandomNumberGenerator& __urng,
3974 const param_type& __p);
3976 param_type _M_param;
3982#if __cpp_impl_three_way_comparison < 201907L
3986 template<
typename _RealType>
3990 {
return !(__d1 == __d2); }
4021 param_type() : param_type(0.5) { }
4024 param_type(
double __p)
4027 __glibcxx_assert((_M_p >= 0.0) && (_M_p <= 1.0));
4035 operator==(
const param_type& __p1,
const param_type& __p2)
4036 {
return __p1._M_p == __p2._M_p; }
4038#if __cpp_impl_three_way_comparison < 201907L
4040 operator!=(
const param_type& __p1,
const param_type& __p2)
4041 {
return !(__p1 == __p2); }
4083 {
return _M_param.p(); }
4090 {
return _M_param; }
4098 { _M_param = __param; }
4117 template<
typename _UniformRandomNumberGenerator>
4120 {
return this->
operator()(__urng, _M_param); }
4122 template<
typename _UniformRandomNumberGenerator>
4124 operator()(_UniformRandomNumberGenerator& __urng,
4125 const param_type& __p)
4127 __detail::_Adaptor<_UniformRandomNumberGenerator, double>
4129 if ((__aurng() - __aurng.min())
4130 < __p.p() * (__aurng.max() - __aurng.min()))
4135 template<
typename _ForwardIterator,
4136 typename _UniformRandomNumberGenerator>
4138 __generate(_ForwardIterator __f, _ForwardIterator __t,
4139 _UniformRandomNumberGenerator& __urng)
4140 { this->__generate(__f, __t, __urng, _M_param); }
4142 template<
typename _ForwardIterator,
4143 typename _UniformRandomNumberGenerator>
4145 __generate(_ForwardIterator __f, _ForwardIterator __t,
4146 _UniformRandomNumberGenerator& __urng,
const param_type& __p)
4147 { this->__generate_impl(__f, __t, __urng, __p); }
4149 template<
typename _UniformRandomNumberGenerator>
4152 _UniformRandomNumberGenerator& __urng,
4154 { this->__generate_impl(__f, __t, __urng, __p); }
4163 {
return __d1._M_param == __d2._M_param; }
4166 template<
typename _ForwardIterator,
4167 typename _UniformRandomNumberGenerator>
4169 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
4170 _UniformRandomNumberGenerator& __urng,
4171 const param_type& __p);
4173 param_type _M_param;
4176#if __cpp_impl_three_way_comparison < 201907L
4184 {
return !(__d1 == __d2); }
4197 template<
typename _CharT,
typename _Traits>
4198 std::basic_ostream<_CharT, _Traits>&
4199 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
4200 const std::bernoulli_distribution& __x);
4211 template<
typename _CharT,
typename _Traits>
4212 inline std::basic_istream<_CharT, _Traits>&
4233 template<
typename _IntType =
int>
4234 class binomial_distribution
4237 "result_type must be an integral type");
4246 typedef binomial_distribution<_IntType> distribution_type;
4247 friend class binomial_distribution<_IntType>;
4249 param_type() : param_type(1) { }
4252 param_type(_IntType __t,
double __p = 0.5)
4253 : _M_t(__t), _M_p(__p)
4255 __glibcxx_assert((_M_t >= _IntType(0))
4270 operator==(
const param_type& __p1,
const param_type& __p2)
4271 {
return __p1._M_t == __p2._M_t && __p1._M_p == __p2._M_p; }
4273#if __cpp_impl_three_way_comparison < 201907L
4275 operator!=(
const param_type& __p1,
const param_type& __p2)
4276 {
return !(__p1 == __p2); }
4287#if _GLIBCXX_USE_C99_MATH_FUNCS
4288 double _M_d1, _M_d2, _M_s1, _M_s2, _M_c,
4289 _M_a1, _M_a123, _M_s, _M_lf, _M_lp1p;
4296 binomial_distribution() : binomial_distribution(1) { }
4300 : _M_param(__t, __p), _M_nd()
4304 binomial_distribution(
const param_type& __p)
4305 : _M_param(__p), _M_nd()
4320 {
return _M_param.t(); }
4327 {
return _M_param.p(); }
4334 {
return _M_param; }
4342 { _M_param = __param; }
4356 {
return _M_param.t(); }
4361 template<
typename _UniformRandomNumberGenerator>
4364 {
return this->
operator()(__urng, _M_param); }
4366 template<
typename _UniformRandomNumberGenerator>
4369 const param_type& __p);
4371 template<
typename _ForwardIterator,
4372 typename _UniformRandomNumberGenerator>
4374 __generate(_ForwardIterator __f, _ForwardIterator __t,
4375 _UniformRandomNumberGenerator& __urng)
4376 { this->__generate(__f, __t, __urng, _M_param); }
4378 template<
typename _ForwardIterator,
4379 typename _UniformRandomNumberGenerator>
4381 __generate(_ForwardIterator __f, _ForwardIterator __t,
4382 _UniformRandomNumberGenerator& __urng,
4383 const param_type& __p)
4384 { this->__generate_impl(__f, __t, __urng, __p); }
4386 template<
typename _UniformRandomNumberGenerator>
4388 __generate(result_type* __f, result_type* __t,
4389 _UniformRandomNumberGenerator& __urng,
4390 const param_type& __p)
4391 { this->__generate_impl(__f, __t, __urng, __p); }
4400 const binomial_distribution& __d2)
4401#ifdef _GLIBCXX_USE_C99_MATH_FUNCS
4402 {
return __d1._M_param == __d2._M_param && __d1._M_nd == __d2._M_nd; }
4404 {
return __d1._M_param == __d2._M_param; }
4417 template<
typename _IntType1,
4418 typename _CharT,
typename _Traits>
4433 template<
typename _IntType1,
4434 typename _CharT,
typename _Traits>
4440 template<
typename _ForwardIterator,
4441 typename _UniformRandomNumberGenerator>
4443 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
4444 _UniformRandomNumberGenerator& __urng,
4445 const param_type& __p);
4447 template<
typename _UniformRandomNumberGenerator>
4449 _M_waiting(_UniformRandomNumberGenerator& __urng,
4450 _IntType __t,
double __q);
4452 param_type _M_param;
4458#if __cpp_impl_three_way_comparison < 201907L
4462 template<
typename _IntType>
4466 {
return !(__d1 == __d2); }
4479 template<
typename _IntType =
int>
4480 class geometric_distribution
4483 "result_type must be an integral type");
4492 typedef geometric_distribution<_IntType> distribution_type;
4493 friend class geometric_distribution<_IntType>;
4495 param_type() : param_type(0.5) { }
4498 param_type(
double __p)
4501 __glibcxx_assert((_M_p > 0.0) && (_M_p < 1.0));
4510 operator==(
const param_type& __p1,
const param_type& __p2)
4511 {
return __p1._M_p == __p2._M_p; }
4513#if __cpp_impl_three_way_comparison < 201907L
4515 operator!=(
const param_type& __p1,
const param_type& __p2)
4516 {
return !(__p1 == __p2); }
4522 { _M_log_1_p =
std::log(1.0 - _M_p); }
4531 geometric_distribution() : geometric_distribution(0.5) { }
4539 geometric_distribution(
const param_type& __p)
4556 {
return _M_param.p(); }
4563 {
return _M_param; }
4571 { _M_param = __param; }
4590 template<
typename _UniformRandomNumberGenerator>
4593 {
return this->
operator()(__urng, _M_param); }
4595 template<
typename _UniformRandomNumberGenerator>
4597 operator()(_UniformRandomNumberGenerator& __urng,
4598 const param_type& __p);
4600 template<
typename _ForwardIterator,
4601 typename _UniformRandomNumberGenerator>
4603 __generate(_ForwardIterator __f, _ForwardIterator __t,
4604 _UniformRandomNumberGenerator& __urng)
4605 { this->__generate(__f, __t, __urng, _M_param); }
4607 template<
typename _ForwardIterator,
4608 typename _UniformRandomNumberGenerator>
4610 __generate(_ForwardIterator __f, _ForwardIterator __t,
4611 _UniformRandomNumberGenerator& __urng,
4612 const param_type& __p)
4613 { this->__generate_impl(__f, __t, __urng, __p); }
4615 template<
typename _UniformRandomNumberGenerator>
4618 _UniformRandomNumberGenerator& __urng,
4620 { this->__generate_impl(__f, __t, __urng, __p); }
4628 const geometric_distribution& __d2)
4629 {
return __d1._M_param == __d2._M_param; }
4632 template<
typename _ForwardIterator,
4633 typename _UniformRandomNumberGenerator>
4635 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
4636 _UniformRandomNumberGenerator& __urng,
4637 const param_type& __p);
4639 param_type _M_param;
4642#if __cpp_impl_three_way_comparison < 201907L
4647 template<
typename _IntType>
4651 {
return !(__d1 == __d2); }
4664 template<
typename _IntType,
4665 typename _CharT,
typename _Traits>
4666 std::basic_ostream<_CharT, _Traits>&
4667 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
4668 const std::geometric_distribution<_IntType>& __x);
4679 template<
typename _IntType,
4680 typename _CharT,
typename _Traits>
4681 std::basic_istream<_CharT, _Traits>&
4682 operator>>(std::basic_istream<_CharT, _Traits>& __is,
4683 std::geometric_distribution<_IntType>& __x);
4696 template<
typename _IntType =
int>
4697 class negative_binomial_distribution
4700 "result_type must be an integral type");
4709 typedef negative_binomial_distribution<_IntType> distribution_type;
4711 param_type() : param_type(1) { }
4714 param_type(_IntType __k,
double __p = 0.5)
4715 : _M_k(__k), _M_p(__p)
4717 __glibcxx_assert((_M_k > 0) && (_M_p > 0.0) && (_M_p <= 1.0));
4729 operator==(
const param_type& __p1,
const param_type& __p2)
4730 {
return __p1._M_k == __p2._M_k && __p1._M_p == __p2._M_p; }
4732#if __cpp_impl_three_way_comparison < 201907L
4734 operator!=(
const param_type& __p1,
const param_type& __p2)
4735 {
return !(__p1 == __p2); }
4743 negative_binomial_distribution() : negative_binomial_distribution(1) { }
4747 : _M_param(__k, __p), _M_gd(__k, (1.0 - __p) / __p)
4751 negative_binomial_distribution(
const param_type& __p)
4752 : _M_param(__p), _M_gd(__p.
k(), (1.0 - __p.
p()) / __p.
p())
4767 {
return _M_param.k(); }
4774 {
return _M_param.p(); }
4781 {
return _M_param; }
4789 { _M_param = __param; }
4808 template<
typename _UniformRandomNumberGenerator>
4812 template<
typename _UniformRandomNumberGenerator>
4814 operator()(_UniformRandomNumberGenerator& __urng,
4815 const param_type& __p);
4817 template<
typename _ForwardIterator,
4818 typename _UniformRandomNumberGenerator>
4820 __generate(_ForwardIterator __f, _ForwardIterator __t,
4821 _UniformRandomNumberGenerator& __urng)
4822 { this->__generate_impl(__f, __t, __urng); }
4824 template<
typename _ForwardIterator,
4825 typename _UniformRandomNumberGenerator>
4827 __generate(_ForwardIterator __f, _ForwardIterator __t,
4828 _UniformRandomNumberGenerator& __urng,
4829 const param_type& __p)
4830 { this->__generate_impl(__f, __t, __urng, __p); }
4832 template<
typename _UniformRandomNumberGenerator>
4834 __generate(result_type* __f, result_type* __t,
4835 _UniformRandomNumberGenerator& __urng)
4836 { this->__generate_impl(__f, __t, __urng); }
4838 template<
typename _UniformRandomNumberGenerator>
4841 _UniformRandomNumberGenerator& __urng,
4843 { this->__generate_impl(__f, __t, __urng, __p); }
4852 const negative_binomial_distribution& __d2)
4853 {
return __d1._M_param == __d2._M_param && __d1._M_gd == __d2._M_gd; }
4866 template<
typename _IntType1,
typename _CharT,
typename _Traits>
4881 template<
typename _IntType1,
typename _CharT,
typename _Traits>
4887 template<
typename _ForwardIterator,
4888 typename _UniformRandomNumberGenerator>
4890 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
4891 _UniformRandomNumberGenerator& __urng);
4892 template<
typename _ForwardIterator,
4893 typename _UniformRandomNumberGenerator>
4895 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
4896 _UniformRandomNumberGenerator& __urng,
4897 const param_type& __p);
4899 param_type _M_param;
4904#if __cpp_impl_three_way_comparison < 201907L
4908 template<
typename _IntType>
4912 {
return !(__d1 == __d2); }
4933 template<
typename _IntType =
int>
4934 class poisson_distribution
4937 "result_type must be an integral type");
4946 typedef poisson_distribution<_IntType> distribution_type;
4947 friend class poisson_distribution<_IntType>;
4949 param_type() : param_type(1.0) { }
4952 param_type(
double __mean)
4955 __glibcxx_assert(_M_mean > 0.0);
4964 operator==(
const param_type& __p1,
const param_type& __p2)
4965 {
return __p1._M_mean == __p2._M_mean; }
4967#if __cpp_impl_three_way_comparison < 201907L
4969 operator!=(
const param_type& __p1,
const param_type& __p2)
4970 {
return !(__p1 == __p2); }
4981#if _GLIBCXX_USE_C99_MATH_FUNCS
4982 double _M_lfm, _M_sm, _M_d, _M_scx, _M_1cx, _M_c2b, _M_cb;
4988 poisson_distribution() : poisson_distribution(1.0) { }
4992 : _M_param(__mean), _M_nd()
4996 poisson_distribution(
const param_type& __p)
4997 : _M_param(__p), _M_nd()
5012 {
return _M_param.mean(); }
5019 {
return _M_param; }
5027 { _M_param = __param; }
5046 template<
typename _UniformRandomNumberGenerator>
5049 {
return this->
operator()(__urng, _M_param); }
5051 template<
typename _UniformRandomNumberGenerator>
5054 const param_type& __p);
5056 template<
typename _ForwardIterator,
5057 typename _UniformRandomNumberGenerator>
5059 __generate(_ForwardIterator __f, _ForwardIterator __t,
5060 _UniformRandomNumberGenerator& __urng)
5061 { this->__generate(__f, __t, __urng, _M_param); }
5063 template<
typename _ForwardIterator,
5064 typename _UniformRandomNumberGenerator>
5066 __generate(_ForwardIterator __f, _ForwardIterator __t,
5067 _UniformRandomNumberGenerator& __urng,
5068 const param_type& __p)
5069 { this->__generate_impl(__f, __t, __urng, __p); }
5071 template<
typename _UniformRandomNumberGenerator>
5073 __generate(result_type* __f, result_type* __t,
5074 _UniformRandomNumberGenerator& __urng,
5075 const param_type& __p)
5076 { this->__generate_impl(__f, __t, __urng, __p); }
5085 const poisson_distribution& __d2)
5086#ifdef _GLIBCXX_USE_C99_MATH_FUNCS
5087 {
return __d1._M_param == __d2._M_param && __d1._M_nd == __d2._M_nd; }
5089 {
return __d1._M_param == __d2._M_param; }
5102 template<
typename _IntType1,
typename _CharT,
typename _Traits>
5117 template<
typename _IntType1,
typename _CharT,
typename _Traits>
5123 template<
typename _ForwardIterator,
5124 typename _UniformRandomNumberGenerator>
5126 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
5127 _UniformRandomNumberGenerator& __urng,
5128 const param_type& __p);
5130 param_type _M_param;
5136#if __cpp_impl_three_way_comparison < 201907L
5140 template<
typename _IntType>
5144 {
return !(__d1 == __d2); }
5165 template<
typename _RealType =
double>
5169 "result_type must be a floating point type");
5180 param_type() : param_type(1.0) { }
5183 param_type(_RealType __lambda)
5184 : _M_lambda(__lambda)
5186 __glibcxx_assert(_M_lambda > _RealType(0));
5191 {
return _M_lambda; }
5194 operator==(
const param_type& __p1,
const param_type& __p2)
5195 {
return __p1._M_lambda == __p2._M_lambda; }
5197#if __cpp_impl_three_way_comparison < 201907L
5199 operator!=(
const param_type& __p1,
const param_type& __p2)
5200 {
return !(__p1 == __p2); }
5204 _RealType _M_lambda;
5220 : _M_param(__lambda)
5241 {
return _M_param.lambda(); }
5248 {
return _M_param; }
5256 { _M_param = __param; }
5275 template<
typename _UniformRandomNumberGenerator>
5278 {
return this->
operator()(__urng, _M_param); }
5280 template<
typename _UniformRandomNumberGenerator>
5282 operator()(_UniformRandomNumberGenerator& __urng,
5283 const param_type& __p)
5285 __detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
5290 template<
typename _ForwardIterator,
5291 typename _UniformRandomNumberGenerator>
5293 __generate(_ForwardIterator __f, _ForwardIterator __t,
5294 _UniformRandomNumberGenerator& __urng)
5295 { this->__generate(__f, __t, __urng, _M_param); }
5297 template<
typename _ForwardIterator,
5298 typename _UniformRandomNumberGenerator>
5300 __generate(_ForwardIterator __f, _ForwardIterator __t,
5301 _UniformRandomNumberGenerator& __urng,
5303 { this->__generate_impl(__f, __t, __urng, __p); }
5305 template<
typename _UniformRandomNumberGenerator>
5308 _UniformRandomNumberGenerator& __urng,
5310 { this->__generate_impl(__f, __t, __urng, __p); }
5319 {
return __d1._M_param == __d2._M_param; }
5322 template<
typename _ForwardIterator,
5323 typename _UniformRandomNumberGenerator>
5325 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
5326 _UniformRandomNumberGenerator& __urng,
5327 const param_type& __p);
5329 param_type _M_param;
5332#if __cpp_impl_three_way_comparison < 201907L
5337 template<
typename _RealType>
5341 {
return !(__d1 == __d2); }
5354 template<
typename _RealType,
typename _CharT,
typename _Traits>
5355 std::basic_ostream<_CharT, _Traits>&
5356 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
5357 const std::exponential_distribution<_RealType>& __x);
5369 template<
typename _RealType,
typename _CharT,
typename _Traits>
5370 std::basic_istream<_CharT, _Traits>&
5371 operator>>(std::basic_istream<_CharT, _Traits>& __is,
5372 std::exponential_distribution<_RealType>& __x);
5387 template<
typename _RealType =
double>
5388 class weibull_distribution
5391 "result_type must be a floating point type");
5400 typedef weibull_distribution<_RealType> distribution_type;
5402 param_type() : param_type(1.0) { }
5405 param_type(_RealType __a, _RealType __b = _RealType(1.0))
5406 : _M_a(__a), _M_b(__b)
5418 operator==(
const param_type& __p1,
const param_type& __p2)
5419 {
return __p1._M_a == __p2._M_a && __p1._M_b == __p2._M_b; }
5421#if __cpp_impl_three_way_comparison < 201907L
5423 operator!=(
const param_type& __p1,
const param_type& __p2)
5424 {
return !(__p1 == __p2); }
5432 weibull_distribution() : weibull_distribution(1.0) { }
5436 : _M_param(__a, __b)
5440 weibull_distribution(
const param_type& __p)
5456 {
return _M_param.a(); }
5463 {
return _M_param.b(); }
5470 {
return _M_param; }
5478 { _M_param = __param; }
5497 template<
typename _UniformRandomNumberGenerator>
5500 {
return this->
operator()(__urng, _M_param); }
5502 template<
typename _UniformRandomNumberGenerator>
5504 operator()(_UniformRandomNumberGenerator& __urng,
5505 const param_type& __p);
5507 template<
typename _ForwardIterator,
5508 typename _UniformRandomNumberGenerator>
5510 __generate(_ForwardIterator __f, _ForwardIterator __t,
5511 _UniformRandomNumberGenerator& __urng)
5512 { this->__generate(__f, __t, __urng, _M_param); }
5514 template<
typename _ForwardIterator,
5515 typename _UniformRandomNumberGenerator>
5517 __generate(_ForwardIterator __f, _ForwardIterator __t,
5518 _UniformRandomNumberGenerator& __urng,
5519 const param_type& __p)
5520 { this->__generate_impl(__f, __t, __urng, __p); }
5522 template<
typename _UniformRandomNumberGenerator>
5525 _UniformRandomNumberGenerator& __urng,
5527 { this->__generate_impl(__f, __t, __urng, __p); }
5535 const weibull_distribution& __d2)
5536 {
return __d1._M_param == __d2._M_param; }
5539 template<
typename _ForwardIterator,
5540 typename _UniformRandomNumberGenerator>
5542 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
5543 _UniformRandomNumberGenerator& __urng,
5544 const param_type& __p);
5546 param_type _M_param;
5549#if __cpp_impl_three_way_comparison < 201907L
5554 template<
typename _RealType>
5558 {
return !(__d1 == __d2); }
5571 template<
typename _RealType,
typename _CharT,
typename _Traits>
5572 std::basic_ostream<_CharT, _Traits>&
5573 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
5574 const std::weibull_distribution<_RealType>& __x);
5586 template<
typename _RealType,
typename _CharT,
typename _Traits>
5587 std::basic_istream<_CharT, _Traits>&
5588 operator>>(std::basic_istream<_CharT, _Traits>& __is,
5589 std::weibull_distribution<_RealType>& __x);
5604 template<
typename _RealType =
double>
5605 class extreme_value_distribution
5608 "result_type must be a floating point type");
5617 typedef extreme_value_distribution<_RealType> distribution_type;
5619 param_type() : param_type(0.0) { }
5622 param_type(_RealType __a, _RealType __b = _RealType(1.0))
5623 : _M_a(__a), _M_b(__b)
5635 operator==(
const param_type& __p1,
const param_type& __p2)
5636 {
return __p1._M_a == __p2._M_a && __p1._M_b == __p2._M_b; }
5638#if __cpp_impl_three_way_comparison < 201907L
5640 operator!=(
const param_type& __p1,
const param_type& __p2)
5641 {
return !(__p1 == __p2); }
5649 extreme_value_distribution() : extreme_value_distribution(0.0) { }
5653 : _M_param(__a, __b)
5657 extreme_value_distribution(
const param_type& __p)
5673 {
return _M_param.a(); }
5680 {
return _M_param.b(); }
5687 {
return _M_param; }
5695 { _M_param = __param; }
5714 template<
typename _UniformRandomNumberGenerator>
5717 {
return this->
operator()(__urng, _M_param); }
5719 template<
typename _UniformRandomNumberGenerator>
5721 operator()(_UniformRandomNumberGenerator& __urng,
5722 const param_type& __p);
5724 template<
typename _ForwardIterator,
5725 typename _UniformRandomNumberGenerator>
5727 __generate(_ForwardIterator __f, _ForwardIterator __t,
5728 _UniformRandomNumberGenerator& __urng)
5729 { this->__generate(__f, __t, __urng, _M_param); }
5731 template<
typename _ForwardIterator,
5732 typename _UniformRandomNumberGenerator>
5734 __generate(_ForwardIterator __f, _ForwardIterator __t,
5735 _UniformRandomNumberGenerator& __urng,
5736 const param_type& __p)
5737 { this->__generate_impl(__f, __t, __urng, __p); }
5739 template<
typename _UniformRandomNumberGenerator>
5742 _UniformRandomNumberGenerator& __urng,
5744 { this->__generate_impl(__f, __t, __urng, __p); }
5752 const extreme_value_distribution& __d2)
5753 {
return __d1._M_param == __d2._M_param; }
5756 template<
typename _ForwardIterator,
5757 typename _UniformRandomNumberGenerator>
5759 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
5760 _UniformRandomNumberGenerator& __urng,
5761 const param_type& __p);
5763 param_type _M_param;
5766#if __cpp_impl_three_way_comparison < 201907L
5771 template<
typename _RealType>
5775 {
return !(__d1 == __d2); }
5788 template<
typename _RealType,
typename _CharT,
typename _Traits>
5789 std::basic_ostream<_CharT, _Traits>&
5790 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
5791 const std::extreme_value_distribution<_RealType>& __x);
5803 template<
typename _RealType,
typename _CharT,
typename _Traits>
5804 std::basic_istream<_CharT, _Traits>&
5805 operator>>(std::basic_istream<_CharT, _Traits>& __is,
5806 std::extreme_value_distribution<_RealType>& __x);
5826 template<
typename _IntType =
int>
5827 class discrete_distribution
5830 "result_type must be an integral type");
5839 typedef discrete_distribution<_IntType> distribution_type;
5840 friend class discrete_distribution<_IntType>;
5843 : _M_prob(), _M_cp()
5846 template<
typename _InputIterator>
5847 param_type(_InputIterator __wbegin,
5848 _InputIterator __wend)
5849 : _M_prob(__wbegin, __wend), _M_cp()
5850 { _M_initialize(); }
5853 : _M_prob(__wil.begin(), __wil.end()), _M_cp()
5854 { _M_initialize(); }
5856 template<
typename _Func>
5857 param_type(
size_t __nw,
double __xmin,
double __xmax,
5861 param_type(
const param_type&) =
default;
5862 param_type& operator=(
const param_type&) =
default;
5869 operator==(
const param_type& __p1,
const param_type& __p2)
5870 {
return __p1._M_prob == __p2._M_prob; }
5872#if __cpp_impl_three_way_comparison < 201907L
5874 operator!=(
const param_type& __p1,
const param_type& __p2)
5875 {
return !(__p1 == __p2); }
5886 discrete_distribution()
5890 template<
typename _InputIterator>
5892 _InputIterator __wend)
5893 : _M_param(__wbegin, __wend)
5896 discrete_distribution(initializer_list<double> __wl)
5900 template<
typename _Func>
5901 discrete_distribution(
size_t __nw,
double __xmin,
double __xmax,
5903 : _M_param(__nw, __xmin, __xmax, __fw)
5924 return _M_param._M_prob.
empty()
5933 {
return _M_param; }
5941 { _M_param = __param; }
5956 return _M_param._M_prob.empty()
5963 template<
typename _UniformRandomNumberGenerator>
5966 {
return this->
operator()(__urng, _M_param); }
5968 template<
typename _UniformRandomNumberGenerator>
5970 operator()(_UniformRandomNumberGenerator& __urng,
5971 const param_type& __p);
5973 template<
typename _ForwardIterator,
5974 typename _UniformRandomNumberGenerator>
5976 __generate(_ForwardIterator __f, _ForwardIterator __t,
5977 _UniformRandomNumberGenerator& __urng)
5978 { this->__generate(__f, __t, __urng, _M_param); }
5980 template<
typename _ForwardIterator,
5981 typename _UniformRandomNumberGenerator>
5983 __generate(_ForwardIterator __f, _ForwardIterator __t,
5984 _UniformRandomNumberGenerator& __urng,
5985 const param_type& __p)
5986 { this->__generate_impl(__f, __t, __urng, __p); }
5988 template<
typename _UniformRandomNumberGenerator>
5991 _UniformRandomNumberGenerator& __urng,
5993 { this->__generate_impl(__f, __t, __urng, __p); }
6001 const discrete_distribution& __d2)
6002 {
return __d1._M_param == __d2._M_param; }
6014 template<
typename _IntType1,
typename _CharT,
typename _Traits>
6030 template<
typename _IntType1,
typename _CharT,
typename _Traits>
6036 template<
typename _ForwardIterator,
6037 typename _UniformRandomNumberGenerator>
6039 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
6040 _UniformRandomNumberGenerator& __urng,
6041 const param_type& __p);
6043 param_type _M_param;
6046#if __cpp_impl_three_way_comparison < 201907L
6051 template<
typename _IntType>
6055 {
return !(__d1 == __d2); }
6074 template<
typename _RealType =
double>
6075 class piecewise_constant_distribution
6078 "result_type must be a floating point type");
6087 typedef piecewise_constant_distribution<_RealType> distribution_type;
6088 friend class piecewise_constant_distribution<_RealType>;
6091 : _M_int(), _M_den(), _M_cp()
6094 template<
typename _InputIteratorB,
typename _InputIteratorW>
6095 param_type(_InputIteratorB __bfirst,
6096 _InputIteratorB __bend,
6097 _InputIteratorW __wbegin);
6099 template<
typename _Func>
6102 template<
typename _Func>
6103 param_type(
size_t __nw, _RealType __xmin, _RealType __xmax,
6107 param_type(
const param_type&) =
default;
6108 param_type& operator=(
const param_type&) =
default;
6116 __tmp[1] = _RealType(1);
6128 operator==(
const param_type& __p1,
const param_type& __p2)
6129 {
return __p1._M_int == __p2._M_int && __p1._M_den == __p2._M_den; }
6131#if __cpp_impl_three_way_comparison < 201907L
6133 operator!=(
const param_type& __p1,
const param_type& __p2)
6134 {
return !(__p1 == __p2); }
6146 piecewise_constant_distribution()
6150 template<
typename _InputIteratorB,
typename _InputIteratorW>
6152 _InputIteratorB __bend,
6153 _InputIteratorW __wbegin)
6154 : _M_param(__bfirst, __bend, __wbegin)
6157 template<
typename _Func>
6158 piecewise_constant_distribution(initializer_list<_RealType> __bl,
6160 : _M_param(__bl, __fw)
6163 template<
typename _Func>
6164 piecewise_constant_distribution(
size_t __nw,
6165 _RealType __xmin, _RealType __xmax,
6167 : _M_param(__nw, __xmin, __xmax, __fw)
6171 piecewise_constant_distribution(
const param_type& __p)
6188 if (_M_param._M_int.empty())
6191 __tmp[1] = _RealType(1);
6195 return _M_param._M_int;
6204 return _M_param._M_den.
empty()
6213 {
return _M_param; }
6221 { _M_param = __param; }
6229 return _M_param._M_int.empty()
6239 return _M_param._M_int.empty()
6246 template<
typename _UniformRandomNumberGenerator>
6249 {
return this->
operator()(__urng, _M_param); }
6251 template<
typename _UniformRandomNumberGenerator>
6253 operator()(_UniformRandomNumberGenerator& __urng,
6254 const param_type& __p);
6256 template<
typename _ForwardIterator,
6257 typename _UniformRandomNumberGenerator>
6259 __generate(_ForwardIterator __f, _ForwardIterator __t,
6260 _UniformRandomNumberGenerator& __urng)
6261 { this->__generate(__f, __t, __urng, _M_param); }
6263 template<
typename _ForwardIterator,
6264 typename _UniformRandomNumberGenerator>
6266 __generate(_ForwardIterator __f, _ForwardIterator __t,
6267 _UniformRandomNumberGenerator& __urng,
6268 const param_type& __p)
6269 { this->__generate_impl(__f, __t, __urng, __p); }
6271 template<
typename _UniformRandomNumberGenerator>
6274 _UniformRandomNumberGenerator& __urng,
6276 { this->__generate_impl(__f, __t, __urng, __p); }
6284 const piecewise_constant_distribution& __d2)
6285 {
return __d1._M_param == __d2._M_param; }
6298 template<
typename _RealType1,
typename _CharT,
typename _Traits>
6314 template<
typename _RealType1,
typename _CharT,
typename _Traits>
6320 template<
typename _ForwardIterator,
6321 typename _UniformRandomNumberGenerator>
6323 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
6324 _UniformRandomNumberGenerator& __urng,
6325 const param_type& __p);
6327 param_type _M_param;
6330#if __cpp_impl_three_way_comparison < 201907L
6335 template<
typename _RealType>
6339 {
return !(__d1 == __d2); }
6354 template<
typename _RealType =
double>
6355 class piecewise_linear_distribution
6358 "result_type must be a floating point type");
6367 typedef piecewise_linear_distribution<_RealType> distribution_type;
6368 friend class piecewise_linear_distribution<_RealType>;
6371 : _M_int(), _M_den(), _M_cp(), _M_m()
6374 template<
typename _InputIteratorB,
typename _InputIteratorW>
6375 param_type(_InputIteratorB __bfirst,
6376 _InputIteratorB __bend,
6377 _InputIteratorW __wbegin);
6379 template<
typename _Func>
6382 template<
typename _Func>
6383 param_type(
size_t __nw, _RealType __xmin, _RealType __xmax,
6387 param_type(
const param_type&) =
default;
6388 param_type& operator=(
const param_type&) =
default;
6396 __tmp[1] = _RealType(1);
6408 operator==(
const param_type& __p1,
const param_type& __p2)
6409 {
return __p1._M_int == __p2._M_int && __p1._M_den == __p2._M_den; }
6411#if __cpp_impl_three_way_comparison < 201907L
6413 operator!=(
const param_type& __p1,
const param_type& __p2)
6414 {
return !(__p1 == __p2); }
6427 piecewise_linear_distribution()
6431 template<
typename _InputIteratorB,
typename _InputIteratorW>
6433 _InputIteratorB __bend,
6434 _InputIteratorW __wbegin)
6435 : _M_param(__bfirst, __bend, __wbegin)
6438 template<
typename _Func>
6439 piecewise_linear_distribution(initializer_list<_RealType> __bl,
6441 : _M_param(__bl, __fw)
6444 template<
typename _Func>
6445 piecewise_linear_distribution(
size_t __nw,
6446 _RealType __xmin, _RealType __xmax,
6448 : _M_param(__nw, __xmin, __xmax, __fw)
6452 piecewise_linear_distribution(
const param_type& __p)
6469 if (_M_param._M_int.empty())
6472 __tmp[1] = _RealType(1);
6476 return _M_param._M_int;
6486 return _M_param._M_den.
empty()
6495 {
return _M_param; }
6503 { _M_param = __param; }
6511 return _M_param._M_int.empty()
6521 return _M_param._M_int.empty()
6528 template<
typename _UniformRandomNumberGenerator>
6531 {
return this->
operator()(__urng, _M_param); }
6533 template<
typename _UniformRandomNumberGenerator>
6535 operator()(_UniformRandomNumberGenerator& __urng,
6536 const param_type& __p);
6538 template<
typename _ForwardIterator,
6539 typename _UniformRandomNumberGenerator>
6541 __generate(_ForwardIterator __f, _ForwardIterator __t,
6542 _UniformRandomNumberGenerator& __urng)
6543 { this->__generate(__f, __t, __urng, _M_param); }
6545 template<
typename _ForwardIterator,
6546 typename _UniformRandomNumberGenerator>
6548 __generate(_ForwardIterator __f, _ForwardIterator __t,
6549 _UniformRandomNumberGenerator& __urng,
6550 const param_type& __p)
6551 { this->__generate_impl(__f, __t, __urng, __p); }
6553 template<
typename _UniformRandomNumberGenerator>
6556 _UniformRandomNumberGenerator& __urng,
6558 { this->__generate_impl(__f, __t, __urng, __p); }
6566 const piecewise_linear_distribution& __d2)
6567 {
return __d1._M_param == __d2._M_param; }
6580 template<
typename _RealType1,
typename _CharT,
typename _Traits>
6596 template<
typename _RealType1,
typename _CharT,
typename _Traits>
6602 template<
typename _ForwardIterator,
6603 typename _UniformRandomNumberGenerator>
6605 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
6606 _UniformRandomNumberGenerator& __urng,
6607 const param_type& __p);
6609 param_type _M_param;
6612#if __cpp_impl_three_way_comparison < 201907L
6617 template<
typename _RealType>
6621 {
return !(__d1 == __d2); }
6652 template<
typename _IntType,
typename = _Require<is_
integral<_IntType>>>
6655 template<
typename _InputIterator>
6656 seed_seq(_InputIterator __begin, _InputIterator __end);
6659 template<
typename _RandomAccessIterator>
6661 generate(_RandomAccessIterator __begin, _RandomAccessIterator __end);
6664 size_t size() const noexcept
6665 {
return _M_v.
size(); }
6667 template<
typename _OutputIterator>
6669 param(_OutputIterator __dest)
const
6670 { std::copy(_M_v.
begin(), _M_v.
end(), __dest); }
6677 std::vector<result_type> _M_v;
6684_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