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#ifndef __SIZEOF_INT128__
83 using type = __rand_uint128;
85 __rand_uint128() =
default;
88 __rand_uint128(uint64_t __lo) noexcept : _M_lo(__lo) { }
90 __rand_uint128(
const __rand_uint128&) =
default;
91 __rand_uint128& operator=(
const __rand_uint128&) =
default;
93 _GLIBCXX14_CONSTEXPR type&
94 operator=(uint64_t __x)
noexcept
95 {
return *
this = type(__x); }
97 _GLIBCXX14_CONSTEXPR type&
99 {
return *
this = *
this + 1; }
101 _GLIBCXX14_CONSTEXPR type&
102 operator--() noexcept
103 {
return *
this = *
this - 1; }
105 _GLIBCXX14_CONSTEXPR type
106 operator++(
int)
noexcept
113 _GLIBCXX14_CONSTEXPR type
114 operator--(
int)
noexcept
121 _GLIBCXX14_CONSTEXPR type&
122 operator+=(
const type& __r)
noexcept
124 _M_hi += __r._M_hi + __builtin_add_overflow(_M_lo, __r._M_lo, &_M_lo);
128 friend _GLIBCXX14_CONSTEXPR type
129 operator+(type __l,
const type& __r)
noexcept
130 {
return __l += __r; }
133 friend _GLIBCXX14_CONSTEXPR type
134 operator+(type __l, uint64_t __r)
noexcept
135 {
return __l += type(__r); }
138 _GLIBCXX14_CONSTEXPR type&
139 operator-=(uint64_t __r)
noexcept
141 _M_hi -= __builtin_sub_overflow(_M_lo, __r, &_M_lo);
145 friend _GLIBCXX14_CONSTEXPR type
146 operator-(type __l, uint64_t __r)
noexcept
147 {
return __l -= __r; }
149 _GLIBCXX14_CONSTEXPR type&
150 operator*=(
const type& __x)
noexcept
153 uint32_t(_M_lo), _M_lo >> 32,
154 uint32_t(_M_hi), _M_hi >> 32,
155 uint32_t(__x._M_lo), __x._M_lo >> 32,
156 uint32_t(__x._M_hi), __x._M_hi >> 32,
159 for (
int __i = 0; __i < 4; ++__i)
162 for (
int __j = __i; __j < 4; ++__j)
164 __c += __a[__i] * __a[4 + __j - __i] + __a[8 + __j];
165 __a[8 + __j] = uint32_t(__c);
169 _M_lo = __a[8] + (__a[9] << 32);
170 _M_hi = __a[10] + (__a[11] << 32);
176 _GLIBCXX14_CONSTEXPR type&
177 operator*=(uint64_t __x)
noexcept
183 constexpr uint64_t __mask = 0xffffffff;
184 uint64_t __ll[2] = { _M_lo >> 32, _M_lo & __mask };
185 uint64_t __xx[2] = { __x >> 32, __x & __mask };
186 uint64_t __l0x0 = __ll[0] * __xx[0];
187 uint64_t __l0x1 = __ll[0] * __xx[1];
188 uint64_t __l1x0 = __ll[1] * __xx[0];
189 uint64_t __l1x1 = __ll[1] * __xx[1];
192 = (__l0x1 & __mask) + (__l1x0 & __mask) + (__l1x1 >> 32);
193 _M_hi = __l0x0 + (__l0x1 >> 32) + (__l1x0 >> 32) + (__mid >> 32);
194 _M_lo = (__mid << 32) + (__l1x1 & __mask);
198 _GLIBCXX14_CONSTEXPR type&
199 operator/=(
const type& __r)
noexcept
204 _M_lo = _M_lo / __r._M_lo;
211 uint32_t(_M_lo), _M_lo >> 32,
212 uint32_t(_M_hi), _M_hi >> 32,
214 uint32_t(__r._M_lo), __r._M_lo >> 32,
215 uint32_t(__r._M_hi), __r._M_hi >> 32,
219 uint64_t __c = 0, __w = 0;
220 if (!__r._M_hi && __r._M_lo <= ~uint32_t(0))
221 for (
int __i = 3; ; --__i)
223 __w = __a[__i] + (__c << 32);
224 __a[9 + __i] = __w / __r._M_lo;
227 __c = __w % __r._M_lo;
232 int __n = 0, __d = 0;
233 uint64_t __q = 0, __s = 0;
234 for (__d = 3; __a[5 + __d] == 0; --__d)
236 __s = (uint64_t(1) << 32) / (__a[5 + __d] + 1);
239 for (
int __i = 0; __i <= 3; ++__i)
241 __w = __a[__i] * __s + __c;
242 __a[__i] = uint32_t(__w);
247 for (
int __i = 0; __i <= 3; ++__i)
249 __w = __a[5 + __i] * __s + __c;
250 __a[5 + __i] = uint32_t(__w);
257 for (
int __i = __n - __d - 1; __i >= 0; --__i)
260 __w = (__a[__n] << 32) + __a[__n - 1];
261 if (__a[__n] != __a[5 + __d])
262 __q = __w / __a[5 + __d];
265 uint64_t __t = __w - __q * __a[5 + __d];
266 if (__t <= ~uint32_t(0)
267 && __a[4 + __d] * __q > (__t << 32) + __a[__n - 2])
270 for (
int __j = 0; __j <= __d; ++__j)
272 __w = __q * __a[5 + __j] + __c;
274 __w = __a[__i + __j] - uint32_t(__w);
275 __a[__i + __j] = uint32_t(__w);
276 __c += (__w >> 32) != 0;
278 if (int64_t(__a[__n]) < int64_t(__c))
282 for (
int __j = 0; __j <= __d; ++__j)
284 __w = __a[__i + __j] + __a[5 + __j] + __c;
286 __a[__i + __j] = uint32_t(__w);
293 _M_lo = __a[9] + (__a[10] << 32);
294 _M_hi = __a[11] + (__a[12] << 32);
300 _GLIBCXX14_CONSTEXPR type&
301 operator%=(uint64_t __m)
noexcept
309 int __shift = __builtin_clzll(__m) + 64 - __builtin_clzll(_M_hi);
313 __x._M_hi = __m << (__shift - 64);
318 __x._M_hi = __m >> (64 - __shift);
319 __x._M_lo = __m << __shift;
322 while (_M_hi != 0 || _M_lo >= __m)
327 _M_hi -= __builtin_sub_overflow(_M_lo, __x._M_lo,
330 __x._M_lo = (__x._M_lo >> 1) | (__x._M_hi << 63);
336 friend _GLIBCXX14_CONSTEXPR type
337 operator*(type __l,
const type& __r)
noexcept
338 {
return __l *= __r; }
340 friend _GLIBCXX14_CONSTEXPR type
341 operator*(type __l, uint64_t __r)
noexcept
342 {
return __l *= __r; }
344 friend _GLIBCXX14_CONSTEXPR type
345 operator/(type __l,
const type& __r)
noexcept
346 {
return __l /= __r; }
348 friend _GLIBCXX14_CONSTEXPR type
349 operator%(type __l, uint64_t __m)
noexcept
350 {
return __l %= __m; }
352 friend _GLIBCXX14_CONSTEXPR type
353 operator~(type __v)
noexcept
355 __v._M_hi = ~__v._M_hi;
356 __v._M_lo = ~__v._M_lo;
360 _GLIBCXX14_CONSTEXPR type&
361 operator>>=(
unsigned __c)
noexcept
365 _M_lo = _M_hi >>= (__c - 64);
370 _M_lo = (_M_lo >> __c) | (_M_hi << (64 - __c));
376 _GLIBCXX14_CONSTEXPR type&
377 operator<<=(
unsigned __c)
noexcept
381 _M_hi = _M_lo << (__c - 64);
386 _M_hi = (_M_hi << __c) | (_M_lo >> (64 - __c));
392 friend _GLIBCXX14_CONSTEXPR type
394 {
return __x >>= __c; }
396 friend _GLIBCXX14_CONSTEXPR type
398 {
return __x <<= __c; }
400 _GLIBCXX14_CONSTEXPR type&
401 operator|=(
const type& __r)
noexcept
408 _GLIBCXX14_CONSTEXPR type&
409 operator^=(
const type& __r)
noexcept
416 _GLIBCXX14_CONSTEXPR type&
417 operator&=(
const type& __r)
noexcept
424 friend _GLIBCXX14_CONSTEXPR type
425 operator|(type __l,
const type& __r)
noexcept
426 {
return __l |= __r; }
428 friend _GLIBCXX14_CONSTEXPR type
429 operator^(type __l,
const type& __r)
noexcept
430 {
return __l ^= __r; }
432 friend _GLIBCXX14_CONSTEXPR type
433 operator&(type __l,
const type& __r)
noexcept
434 {
return __l &= __r; }
436 friend _GLIBCXX14_CONSTEXPR type
437 operator&(type __l, uint64_t __r)
noexcept
444#if __cpp_impl_three_way_comparison >= 201907L
445 friend std::strong_ordering
446 operator<=>(
const type&,
const type&) =
default;
449 operator==(
const type&,
const type&) =
default;
451 friend constexpr bool
452 operator==(
const type& __l,
const type& __r)
noexcept
453 {
return __l._M_hi == __r._M_hi && __l._M_lo == __r._M_lo; }
455 friend _GLIBCXX14_CONSTEXPR
bool
456 operator<(
const type& __l,
const type& __r)
noexcept
458 if (__l._M_hi < __r._M_hi)
460 else if (__l._M_hi == __r._M_hi)
461 return __l._M_lo < __r._M_lo;
466 friend _GLIBCXX14_CONSTEXPR
bool
467 operator<=(
const type& __l,
const type& __r)
noexcept
468 {
return !(__r < __l); }
471 friend _GLIBCXX14_CONSTEXPR
bool
472 operator==(
const type& __l, uint64_t __r)
noexcept
473 {
return __l == type(__r); }
475 template<
typename _RealT>
476 constexpr explicit operator _RealT() const noexcept
478 static_assert(std::is_floating_point<_RealT>::value,
479 "template argument must be a floating point type");
482 : _RealT(_M_hi) * _RealT(18446744073709551616.0)
487 constexpr explicit operator uint64_t() const noexcept
495 template<
typename _UIntType,
size_t __w,
496 bool = __w < static_cast<size_t>
499 {
static constexpr _UIntType __value = 0; };
501 template<
typename _UIntType,
size_t __w>
502 struct _Shift<_UIntType, __w, true>
503 {
static constexpr _UIntType __value = _UIntType(1) << __w; };
506 int __which = ((__s <= __CHAR_BIT__ *
sizeof (int))
507 + (__s <= __CHAR_BIT__ *
sizeof (long))
508 + (__s <= __CHAR_BIT__ *
sizeof (
long long))
511 struct _Select_uint_least_t
513 static_assert(__which < 0,
514 "sorry, would be too much trouble for a slow result");
518 struct _Select_uint_least_t<__s, 4>
519 {
using type =
unsigned int; };
522 struct _Select_uint_least_t<__s, 3>
523 {
using type =
unsigned long; };
526 struct _Select_uint_least_t<__s, 2>
527 {
using type =
unsigned long long; };
529#if __SIZEOF_INT128__ > __SIZEOF_LONG_LONG__
531 struct _Select_uint_least_t<__s, 1>
532 { __extension__
using type =
unsigned __int128; };
533#elif __has_builtin(__builtin_add_overflow) \
534 && __has_builtin(__builtin_sub_overflow) \
535 && defined __UINT64_TYPE__
537 struct _Select_uint_least_t<__s, 1>
538 {
using type = __rand_uint128; };
542 template<
typename _Tp, _Tp __m, _Tp __a, _Tp __c,
543 bool __big_enough = (!(__m & (__m - 1))
544 || (_Tp(-1) - __c) / __a >= __m - 1),
545 bool __schrage_ok = __m % __a < __m / __a>
552 =
typename _Select_uint_least_t<
std::__lg(__a)
554 return static_cast<_Tp
>((_Tp2(__a) * __x + __c) % __m);
559 template<
typename _Tp, _Tp __m, _Tp __a, _Tp __c>
560 struct _Mod<_Tp, __m, __a, __c, false, true>
569 template<
typename _Tp, _Tp __m, _Tp __a, _Tp __c,
bool __s>
570 struct _Mod<_Tp, __m, __a, __c, true, __s>
575 _Tp __res = __a * __x + __c;
582 template<
typename _Tp, _Tp __m, _Tp __a = 1, _Tp __c = 0>
586 if constexpr (__a == 0)
589 return _Mod<_Tp, __m, __a, __c>::__calc(__x);
596 template<
typename _Engine,
typename _DInputType>
599 static_assert(std::is_floating_point<_DInputType>::value,
600 "template argument must be a floating point type");
603 _Adaptor(_Engine& __g)
608 {
return _DInputType(0); }
612 {
return _DInputType(1); }
636 template<
typename _Sseq>
637 using __seed_seq_generate_t =
decltype(
641 template<
typename _Sseq,
typename _Engine,
typename _Res,
642 typename _GenerateCheck = __seed_seq_generate_t<_Sseq>>
643 using _If_seed_seq_for = _Require<
644 __not_<is_same<__remove_cvref_t<_Sseq>, _Engine>>,
645 is_unsigned<typename _Sseq::result_type>,
646 __not_<is_convertible<_Sseq, _Res>>
649#pragma GCC diagnostic pop
694 template<
typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
698 "result_type must be an unsigned integral type");
699 static_assert(__m == 0u || (__a < __m && __c < __m),
700 "template argument substituting __m out of bounds");
702 template<
typename _Sseq>
743 template<
typename _Sseq,
typename = _If_seed_seq<_Sseq>>
764 template<
typename _Sseq>
776 {
return __c == 0u ? 1u : 0u; }
789 discard(
unsigned long long __z)
791 for (; __z != 0ULL; --__z)
801 _M_x = __detail::__mod<_UIntType, __m, __a, __c>(_M_x);
819 {
return __lhs._M_x == __rhs._M_x; }
829 template<
typename _UIntType1, _UIntType1 __a1, _UIntType1 __c1,
830 _UIntType1 __m1,
typename _CharT,
typename _Traits>
834 __a1, __c1, __m1>& __lcr);
849 template<
typename _UIntType1, _UIntType1 __a1, _UIntType1 __c1,
850 _UIntType1 __m1,
typename _CharT,
typename _Traits>
860#if __cpp_impl_three_way_comparison < 201907L
872 template<
typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
878 {
return !(__lhs == __rhs); }
912 template<
typename _UIntType,
size_t __w,
913 size_t __n,
size_t __m,
size_t __r,
914 _UIntType __a,
size_t __u, _UIntType __d,
size_t __s,
915 _UIntType __b,
size_t __t,
916 _UIntType __c,
size_t __l, _UIntType __f>
917 class mersenne_twister_engine
920 "result_type must be an unsigned integral type");
921 static_assert(1u <= __m && __m <= __n,
922 "template argument substituting __m out of bounds");
923 static_assert(__r <= __w,
"template argument substituting "
925 static_assert(__u <= __w,
"template argument substituting "
927 static_assert(__s <= __w,
"template argument substituting "
929 static_assert(__t <= __w,
"template argument substituting "
931 static_assert(__l <= __w,
"template argument substituting "
933 static_assert(__w <= std::numeric_limits<_UIntType>::digits,
934 "template argument substituting __w out of bound");
935 static_assert(__a <= (__detail::_Shift<_UIntType, __w>::__value - 1),
936 "template argument substituting __a out of bound");
937 static_assert(__b <= (__detail::_Shift<_UIntType, __w>::__value - 1),
938 "template argument substituting __b out of bound");
939 static_assert(__c <= (__detail::_Shift<_UIntType, __w>::__value - 1),
940 "template argument substituting __c out of bound");
941 static_assert(__d <= (__detail::_Shift<_UIntType, __w>::__value - 1),
942 "template argument substituting __d out of bound");
943 static_assert(__f <= (__detail::_Shift<_UIntType, __w>::__value - 1),
944 "template argument substituting __f out of bound");
946 template<
typename _Sseq>
948 = __detail::_If_seed_seq_for<_Sseq, mersenne_twister_engine,
956 static constexpr size_t word_size = __w;
957 static constexpr size_t state_size = __n;
958 static constexpr size_t shift_size = __m;
959 static constexpr size_t mask_bits = __r;
961 static constexpr size_t tempering_u = __u;
963 static constexpr size_t tempering_s = __s;
965 static constexpr size_t tempering_t = __t;
967 static constexpr size_t tempering_l = __l;
968 static constexpr result_type initialization_multiplier = __f;
973 mersenne_twister_engine() : mersenne_twister_engine(default_seed) { }
985 template<
typename _Sseq,
typename = _If_seed_seq<_Sseq>>
987 mersenne_twister_engine(_Sseq& __q)
991 seed(result_type __sd = default_seed);
993 template<
typename _Sseq>
1009 {
return __detail::_Shift<_UIntType, __w>::__value - 1; }
1015 discard(
unsigned long long __z);
1033 operator==(
const mersenne_twister_engine& __lhs,
1034 const mersenne_twister_engine& __rhs)
1035 {
return (std::equal(__lhs._M_x, __lhs._M_x + state_size, __rhs._M_x)
1036 && __lhs._M_p == __rhs._M_p); }
1050 template<
typename _UIntType1,
1051 size_t __w1,
size_t __n1,
1052 size_t __m1,
size_t __r1,
1053 _UIntType1 __a1,
size_t __u1,
1054 _UIntType1 __d1,
size_t __s1,
1055 _UIntType1 __b1,
size_t __t1,
1056 _UIntType1 __c1,
size_t __l1, _UIntType1 __f1,
1057 typename _CharT,
typename _Traits>
1061 __m1, __r1, __a1, __u1, __d1, __s1, __b1, __t1, __c1,
1076 template<
typename _UIntType1,
1077 size_t __w1,
size_t __n1,
1078 size_t __m1,
size_t __r1,
1079 _UIntType1 __a1,
size_t __u1,
1080 _UIntType1 __d1,
size_t __s1,
1081 _UIntType1 __b1,
size_t __t1,
1082 _UIntType1 __c1,
size_t __l1, _UIntType1 __f1,
1083 typename _CharT,
typename _Traits>
1087 __r1, __a1, __u1, __d1, __s1, __b1, __t1, __c1,
1093 _UIntType _M_x[state_size];
1097#if __cpp_impl_three_way_comparison < 201907L
1110 template<
typename _UIntType,
size_t __w,
1111 size_t __n,
size_t __m,
size_t __r,
1112 _UIntType __a,
size_t __u, _UIntType __d,
size_t __s,
1113 _UIntType __b,
size_t __t,
1114 _UIntType __c,
size_t __l, _UIntType __f>
1117 __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>& __lhs,
1119 __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>& __rhs)
1120 {
return !(__lhs == __rhs); }
1141 template<
typename _UIntType,
size_t __w,
size_t __s,
size_t __r>
1142 class subtract_with_carry_engine
1145 "result_type must be an unsigned integral type");
1146 static_assert(0u < __s && __s < __r,
1148 static_assert(0u < __w && __w <= std::numeric_limits<_UIntType>::digits,
1149 "template argument substituting __w out of bounds");
1151 template<
typename _Sseq>
1153 = __detail::_If_seed_seq_for<_Sseq, subtract_with_carry_engine,
1161 static constexpr size_t word_size = __w;
1162 static constexpr size_t short_lag = __s;
1163 static constexpr size_t long_lag = __r;
1164 static constexpr uint_least32_t default_seed = 19780503u;
1166 subtract_with_carry_engine() : subtract_with_carry_engine(0u)
1183 template<
typename _Sseq,
typename = _If_seed_seq<_Sseq>>
1185 subtract_with_carry_engine(_Sseq& __q)
1207 template<
typename _Sseq>
1225 {
return __detail::_Shift<_UIntType, __w>::__value - 1; }
1231 discard(
unsigned long long __z)
1233 for (; __z != 0ULL; --__z)
1256 operator==(
const subtract_with_carry_engine& __lhs,
1257 const subtract_with_carry_engine& __rhs)
1258 {
return (std::equal(__lhs._M_x, __lhs._M_x + long_lag, __rhs._M_x)
1259 && __lhs._M_carry == __rhs._M_carry
1260 && __lhs._M_p == __rhs._M_p); }
1274 template<
typename _UIntType1,
size_t __w1,
size_t __s1,
size_t __r1,
1275 typename _CharT,
typename _Traits>
1293 template<
typename _UIntType1,
size_t __w1,
size_t __s1,
size_t __r1,
1294 typename _CharT,
typename _Traits>
1302 _UIntType _M_x[long_lag];
1307#if __cpp_impl_three_way_comparison < 201907L
1320 template<
typename _UIntType,
size_t __w,
size_t __s,
size_t __r>
1326 {
return !(__lhs == __rhs); }
1338 template<
typename _RandomNumberEngine,
size_t __p,
size_t __r>
1341 static_assert(1 <= __r && __r <= __p,
1342 "template argument substituting __r out of bounds");
1348 template<
typename _Sseq>
1354 static constexpr size_t block_size = __p;
1355 static constexpr size_t used_block = __r;
1363 : _M_b(), _M_n(0) { }
1373 : _M_b(__rng), _M_n(0) { }
1383 : _M_b(
std::
move(__rng)), _M_n(0) { }
1393 : _M_b(__s), _M_n(0) { }
1400 template<
typename _Sseq,
typename = _If_seed_seq<_Sseq>>
1403 : _M_b(__q), _M_n(0)
1433 template<
typename _Sseq>
1445 const _RandomNumberEngine&
1446 base() const noexcept
1454 {
return _RandomNumberEngine::min(); }
1461 {
return _RandomNumberEngine::max(); }
1467 discard(
unsigned long long __z)
1469 for (; __z != 0ULL; --__z)
1493 {
return __lhs._M_b == __rhs._M_b && __lhs._M_n == __rhs._M_n; }
1506 template<
typename _RandomNumberEngine1,
size_t __p1,
size_t __r1,
1507 typename _CharT,
typename _Traits>
1524 template<
typename _RandomNumberEngine1,
size_t __p1,
size_t __r1,
1525 typename _CharT,
typename _Traits>
1532 _RandomNumberEngine _M_b;
1536#if __cpp_impl_three_way_comparison < 201907L
1548 template<
typename _RandomNumberEngine,
size_t __p,
size_t __r>
1554 {
return !(__lhs == __rhs); }
1564 template<
typename _RandomNumberEngine,
size_t __w,
typename _UIntType>
1568 "result_type must be an unsigned integral type");
1569 static_assert(0u < __w && __w <= std::numeric_limits<_UIntType>::digits,
1570 "template argument substituting __w out of bounds");
1572 template<
typename _Sseq>
1624 template<
typename _Sseq,
typename = _If_seed_seq<_Sseq>>
1651 template<
typename _Sseq>
1660 const _RandomNumberEngine&
1661 base() const noexcept
1676 {
return __detail::_Shift<_UIntType, __w>::__value - 1; }
1682 discard(
unsigned long long __z)
1684 for (; __z != 0ULL; --__z)
1709 {
return __lhs._M_b == __rhs._M_b; }
1723 template<
typename _CharT,
typename _Traits>
1727 __w, _UIntType>& __x)
1734 _RandomNumberEngine _M_b;
1737#if __cpp_impl_three_way_comparison < 201907L
1750 template<
typename _RandomNumberEngine,
size_t __w,
typename _UIntType>
1756 {
return !(__lhs == __rhs); }
1769 template<
typename _RandomNumberEngine,
size_t __w,
typename _UIntType,
1770 typename _CharT,
typename _Traits>
1771 std::basic_ostream<_CharT, _Traits>&
1772 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
1773 const std::independent_bits_engine<_RandomNumberEngine,
1774 __w, _UIntType>& __x)
1791 template<
typename _RandomNumberEngine,
size_t __k>
1794 static_assert(1u <= __k,
"template argument substituting "
1795 "__k out of bound");
1801 template<
typename _Sseq>
1806 static constexpr size_t table_size = __k;
1815 { _M_initialize(); }
1826 { _M_initialize(); }
1837 { _M_initialize(); }
1848 { _M_initialize(); }
1855 template<
typename _Sseq,
typename = _If_seed_seq<_Sseq>>
1859 { _M_initialize(); }
1888 template<
typename _Sseq>
1899 const _RandomNumberEngine&
1900 base() const noexcept
1908 {
return _RandomNumberEngine::min(); }
1915 {
return _RandomNumberEngine::max(); }
1921 discard(
unsigned long long __z)
1923 for (; __z != 0ULL; --__z)
1947 {
return (__lhs._M_b == __rhs._M_b
1948 && std::equal(__lhs._M_v, __lhs._M_v + __k, __rhs._M_v)
1949 && __lhs._M_y == __rhs._M_y); }
1962 template<
typename _RandomNumberEngine1,
size_t __k1,
1963 typename _CharT,
typename _Traits>
1980 template<
typename _RandomNumberEngine1,
size_t __k1,
1981 typename _CharT,
typename _Traits>
1987 void _M_initialize()
1989 for (
size_t __i = 0; __i < __k; ++__i)
1994 _RandomNumberEngine _M_b;
1995 result_type _M_v[__k];
1999#if __cpp_impl_three_way_comparison < 201907L
2011 template<
typename _RandomNumberEngine,
size_t __k>
2017 {
return !(__lhs == __rhs); }
2020#if __glibcxx_philox_engine
2049 template<
typename _UIntType,
size_t __w,
size_t __n,
size_t __r,
2050 _UIntType... __consts>
2053 static_assert(__n == 2 || __n == 4,
2054 "template argument N must be either 2 or 4");
2055 static_assert(
sizeof...(__consts) == __n,
2056 "length of consts array must match specified N");
2057 static_assert(0 < __r,
"a number of rounds must be specified");
2058 static_assert((0 < __w && __w <= numeric_limits<_UIntType>::digits),
2059 "specified bitlength must match input type");
2061 template<
typename _Sseq>
2062 static constexpr bool __is_seed_seq =
requires {
2063 typename __detail::_If_seed_seq_for<_Sseq, philox_engine, _UIntType>;
2066 template <
size_t __ind0,
size_t __ind1>
2068 array<_UIntType, __n / 2>
2071 if constexpr (__n == 4)
2072 return {__consts...[__ind0], __consts...[__ind1]};
2074 return {__consts...[__ind0]};
2078 using result_type = _UIntType;
2080 static constexpr size_t word_size = __w;
2081 static constexpr size_t word_count = __n;
2082 static constexpr size_t round_count = __r;
2083 static constexpr array<result_type, __n / 2> multipliers
2084 = _S_popArray<0,2>();
2085 static constexpr array<result_type, __n / 2> round_consts
2086 = _S_popArray<1,3>();
2089 static constexpr result_type
2094 static constexpr result_type
2097 return ((1ull << (__w - 1)) | ((1ull << (__w - 1)) - 1));
2100 static constexpr result_type default_seed = 20111115u;
2104 : philox_engine(default_seed)
2108 philox_engine(result_type __value)
2109 : _M_x{}, _M_k{}, _M_y{}, _M_i(__n - 1)
2110 { _M_k[0] = __value & max(); }
2116 template<
typename _Sseq>
requires __is_seed_seq<_Sseq>
2118 philox_engine(_Sseq& __q)
2124 seed(result_type __value = default_seed)
2129 _M_k[0] = __value & max();
2137 template<
typename _Sseq>
2139 seed(_Sseq& __q)
requires __is_seed_seq<_Sseq>;
2146 set_counter(
const array<result_type, __n>& __counter)
2148 for (
size_t __j = 0; __j < __n; ++__j)
2149 _M_x[__j] = __counter[__n - 1 - __j] & max();
2159 operator==(
const philox_engine&,
const philox_engine&) =
default;
2177 discard(
unsigned long long __z)
2190 template<
typename _CharT,
typename _Traits>
2191 friend basic_ostream<_CharT, _Traits>&
2192 operator<<(basic_ostream<_CharT, _Traits>& __os,
2193 const philox_engine& __x)
2195 const typename ios_base::fmtflags __flags = __os.flags();
2196 const _CharT __fill = __os.fill();
2197 __os.flags(ios_base::dec | ios_base::left);
2198 _CharT __space = __os.widen(
' ');
2200 for (
auto& __subkey : __x._M_k)
2201 __os << __subkey << __space;
2202 for (
auto& __ctr : __x._M_x)
2203 __os << __ctr << __space;
2205 __os.flags(__flags);
2217 template <
typename _CharT,
typename _Traits>
2218 friend basic_istream<_CharT, _Traits>&
2219 operator>>(basic_istream<_CharT, _Traits>& __is,
2222 const typename ios_base::fmtflags __flags = __is.flags();
2223 __is.flags(ios_base::dec | ios_base::skipws);
2224 for (
auto& __subkey : __x._M_k)
2226 for (
auto& __ctr : __x._M_x)
2228 array<_UIntType, __n> __tmpCtr = __x._M_x;
2229 unsigned char __setIndex = 0;
2230 for (
size_t __j = 0; __j < __x._M_x.size(); ++__j)
2232 if (__x._M_x[__j] > 0)
2238 for (
size_t __j = 0; __j <= __setIndex; ++__j)
2240 if (__j != __setIndex)
2241 __x._M_x[__j] = max();
2246 __x._M_x = __tmpCtr;
2248 __is.flags(__flags);
2254 array<_UIntType, __n> _M_x;
2255 array<_UIntType, __n / 2> _M_k;
2256 array<_UIntType, __n> _M_y;
2257 unsigned long long _M_i = 0;
2261 _S_mulhi(_UIntType __a, _UIntType __b);
2265 _S_mullo(_UIntType __a, _UIntType __b);
2311 0xb5026f5aa96619e9ULL, 29,
2312 0x5555555555555555ULL, 17,
2313 0x71d67fffeda60000ULL, 37,
2314 0xfff7eee000000000ULL, 43,
2331#if __glibcxx_philox_engine
2334 typedef philox_engine<
2337 0xCD9E8D57, 0x9E3779B9,
2338 0xD2511F53, 0xBB67AE85> philox4x32;
2341 typedef philox_engine<
2344 0xCA5A826395121157, 0x9E3779B97F4A7C15,
2345 0xD2E7470EE14C6C93, 0xBB67AE8584CAA73B> philox4x64;
2363 random_device() { _M_init(
"default"); }
2380 entropy() const noexcept
2381 {
return this->_M_getentropy(); }
2385 {
return this->_M_getval(); }
2388 random_device(
const random_device&) =
delete;
2389 void operator=(
const random_device&) =
delete;
2399 double _M_getentropy() const noexcept;
2401 void _M_init(const
char*,
size_t);
2431#if __cpp_impl_three_way_comparison < 201907L
2436 template<
typename _IntType>
2438 operator!=(
const std::uniform_int_distribution<_IntType>& __d1,
2439 const std::uniform_int_distribution<_IntType>& __d2)
2440 {
return !(__d1 == __d2); }
2453 template<
typename _IntType,
typename _CharT,
typename _Traits>
2454 std::basic_ostream<_CharT, _Traits>&
2455 operator<<(std::basic_ostream<_CharT, _Traits>&,
2456 const std::uniform_int_distribution<_IntType>&);
2467 template<
typename _IntType,
typename _CharT,
typename _Traits>
2468 std::basic_istream<_CharT, _Traits>&
2469 operator>>(std::basic_istream<_CharT, _Traits>&,
2470 std::uniform_int_distribution<_IntType>&);
2483 template<
typename _RealType =
double>
2487 "result_type must be a floating point type");
2498 param_type() : param_type(0) { }
2501 param_type(_RealType __a, _RealType __b = _RealType(1))
2502 : _M_a(__a), _M_b(__b)
2504 __glibcxx_assert(_M_a <= _M_b);
2516 operator==(
const param_type& __p1,
const param_type& __p2)
2517 {
return __p1._M_a == __p2._M_a && __p1._M_b == __p2._M_b; }
2519#if __cpp_impl_three_way_comparison < 201907L
2521 operator!=(
const param_type& __p1,
const param_type& __p2)
2522 {
return !(__p1 == __p2); }
2546 : _M_param(__a, __b)
2564 {
return _M_param.a(); }
2568 {
return _M_param.b(); }
2575 {
return _M_param; }
2583 { _M_param = __param; }
2590 {
return this->a(); }
2597 {
return this->b(); }
2602 template<
typename _UniformRandomNumberGenerator>
2605 {
return this->
operator()(__urng, _M_param); }
2607 template<
typename _UniformRandomNumberGenerator>
2609 operator()(_UniformRandomNumberGenerator& __urng,
2610 const param_type& __p)
2612 __detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
2614 return (__aurng() * (__p.b() - __p.a())) + __p.a();
2617 template<
typename _ForwardIterator,
2618 typename _UniformRandomNumberGenerator>
2620 __generate(_ForwardIterator __f, _ForwardIterator __t,
2621 _UniformRandomNumberGenerator& __urng)
2622 { this->__generate(__f, __t, __urng, _M_param); }
2624 template<
typename _ForwardIterator,
2625 typename _UniformRandomNumberGenerator>
2627 __generate(_ForwardIterator __f, _ForwardIterator __t,
2628 _UniformRandomNumberGenerator& __urng,
2630 { this->__generate_impl(__f, __t, __urng, __p); }
2632 template<
typename _UniformRandomNumberGenerator>
2635 _UniformRandomNumberGenerator& __urng,
2637 { this->__generate_impl(__f, __t, __urng, __p); }
2646 {
return __d1._M_param == __d2._M_param; }
2649 template<
typename _ForwardIterator,
2650 typename _UniformRandomNumberGenerator>
2652 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
2653 _UniformRandomNumberGenerator& __urng,
2654 const param_type& __p);
2656 param_type _M_param;
2659#if __cpp_impl_three_way_comparison < 201907L
2664 template<
typename _IntType>
2668 {
return !(__d1 == __d2); }
2681 template<
typename _RealType,
typename _CharT,
typename _Traits>
2682 std::basic_ostream<_CharT, _Traits>&
2683 operator<<(std::basic_ostream<_CharT, _Traits>&,
2684 const std::uniform_real_distribution<_RealType>&);
2695 template<
typename _RealType,
typename _CharT,
typename _Traits>
2696 std::basic_istream<_CharT, _Traits>&
2697 operator>>(std::basic_istream<_CharT, _Traits>&,
2698 std::uniform_real_distribution<_RealType>&);
2720 template<
typename _RealType =
double>
2721 class normal_distribution
2724 "result_type must be a floating point type");
2733 typedef normal_distribution<_RealType> distribution_type;
2735 param_type() : param_type(0.0) { }
2738 param_type(_RealType __mean, _RealType __stddev = _RealType(1))
2739 : _M_mean(__mean), _M_stddev(__stddev)
2741 __glibcxx_assert(_M_stddev > _RealType(0));
2750 {
return _M_stddev; }
2753 operator==(
const param_type& __p1,
const param_type& __p2)
2754 {
return (__p1._M_mean == __p2._M_mean
2755 && __p1._M_stddev == __p2._M_stddev); }
2757#if __cpp_impl_three_way_comparison < 201907L
2759 operator!=(
const param_type& __p1,
const param_type& __p2)
2760 {
return !(__p1 == __p2); }
2765 _RealType _M_stddev;
2769 normal_distribution() : normal_distribution(0.0) { }
2778 : _M_param(__mean, __stddev)
2791 { _M_saved_available =
false; }
2798 {
return _M_param.mean(); }
2805 {
return _M_param.stddev(); }
2812 {
return _M_param; }
2820 { _M_param = __param; }
2839 template<
typename _UniformRandomNumberGenerator>
2842 {
return this->
operator()(__urng, _M_param); }
2844 template<
typename _UniformRandomNumberGenerator>
2847 const param_type& __p);
2849 template<
typename _ForwardIterator,
2850 typename _UniformRandomNumberGenerator>
2852 __generate(_ForwardIterator __f, _ForwardIterator __t,
2853 _UniformRandomNumberGenerator& __urng)
2854 { this->__generate(__f, __t, __urng, _M_param); }
2856 template<
typename _ForwardIterator,
2857 typename _UniformRandomNumberGenerator>
2859 __generate(_ForwardIterator __f, _ForwardIterator __t,
2860 _UniformRandomNumberGenerator& __urng,
2861 const param_type& __p)
2862 { this->__generate_impl(__f, __t, __urng, __p); }
2864 template<
typename _UniformRandomNumberGenerator>
2866 __generate(result_type* __f, result_type* __t,
2867 _UniformRandomNumberGenerator& __urng,
2868 const param_type& __p)
2869 { this->__generate_impl(__f, __t, __urng, __p); }
2876 template<
typename _RealType1>
2891 template<
typename _RealType1,
typename _CharT,
typename _Traits>
2906 template<
typename _RealType1,
typename _CharT,
typename _Traits>
2912 template<
typename _ForwardIterator,
2913 typename _UniformRandomNumberGenerator>
2915 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
2916 _UniformRandomNumberGenerator& __urng,
2917 const param_type& __p);
2919 param_type _M_param;
2921 bool _M_saved_available =
false;
2924#if __cpp_impl_three_way_comparison < 201907L
2928 template<
typename _RealType>
2932 {
return !(__d1 == __d2); }
2947 template<
typename _RealType =
double>
2948 class lognormal_distribution
2951 "result_type must be a floating point type");
2960 typedef lognormal_distribution<_RealType> distribution_type;
2962 param_type() : param_type(0.0) { }
2965 param_type(_RealType __m, _RealType __s = _RealType(1))
2966 : _M_m(__m), _M_s(__s)
2978 operator==(
const param_type& __p1,
const param_type& __p2)
2979 {
return __p1._M_m == __p2._M_m && __p1._M_s == __p2._M_s; }
2981#if __cpp_impl_three_way_comparison < 201907L
2983 operator!=(
const param_type& __p1,
const param_type& __p2)
2984 {
return !(__p1 == __p2); }
2992 lognormal_distribution() : lognormal_distribution(0.0) { }
2996 : _M_param(__m, __s), _M_nd()
3000 lognormal_distribution(
const param_type& __p)
3001 : _M_param(__p), _M_nd()
3016 {
return _M_param.m(); }
3020 {
return _M_param.s(); }
3027 {
return _M_param; }
3035 { _M_param = __param; }
3054 template<
typename _UniformRandomNumberGenerator>
3057 {
return this->
operator()(__urng, _M_param); }
3059 template<
typename _UniformRandomNumberGenerator>
3061 operator()(_UniformRandomNumberGenerator& __urng,
3062 const param_type& __p)
3063 {
return std::exp(__p.s() * _M_nd(__urng) + __p.m()); }
3065 template<
typename _ForwardIterator,
3066 typename _UniformRandomNumberGenerator>
3068 __generate(_ForwardIterator __f, _ForwardIterator __t,
3069 _UniformRandomNumberGenerator& __urng)
3070 { this->__generate(__f, __t, __urng, _M_param); }
3072 template<
typename _ForwardIterator,
3073 typename _UniformRandomNumberGenerator>
3075 __generate(_ForwardIterator __f, _ForwardIterator __t,
3076 _UniformRandomNumberGenerator& __urng,
3078 { this->__generate_impl(__f, __t, __urng, __p); }
3080 template<
typename _UniformRandomNumberGenerator>
3083 _UniformRandomNumberGenerator& __urng,
3085 { this->__generate_impl(__f, __t, __urng, __p); }
3094 const lognormal_distribution& __d2)
3095 {
return (__d1._M_param == __d2._M_param
3096 && __d1._M_nd == __d2._M_nd); }
3108 template<
typename _RealType1,
typename _CharT,
typename _Traits>
3123 template<
typename _RealType1,
typename _CharT,
typename _Traits>
3129 template<
typename _ForwardIterator,
3130 typename _UniformRandomNumberGenerator>
3132 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
3133 _UniformRandomNumberGenerator& __urng,
3134 const param_type& __p);
3136 param_type _M_param;
3141#if __cpp_impl_three_way_comparison < 201907L
3145 template<
typename _RealType>
3149 {
return !(__d1 == __d2); }
3172 template<
typename _RealType =
double>
3176 "result_type must be a floating point type");
3188 param_type() : param_type(1.0) { }
3191 param_type(_RealType __alpha_val, _RealType __beta_val = _RealType(1))
3192 : _M_alpha(__alpha_val), _M_beta(__beta_val)
3194 __glibcxx_assert(_M_alpha > _RealType(0));
3200 {
return _M_alpha; }
3207 operator==(
const param_type& __p1,
const param_type& __p2)
3208 {
return (__p1._M_alpha == __p2._M_alpha
3209 && __p1._M_beta == __p2._M_beta); }
3211#if __cpp_impl_three_way_comparison < 201907L
3213 operator!=(
const param_type& __p1,
const param_type& __p2)
3214 {
return !(__p1 == __p2); }
3224 _RealType _M_malpha, _M_a2;
3239 _RealType __beta_val = _RealType(1))
3240 : _M_param(__alpha_val, __beta_val), _M_nd()
3245 : _M_param(__p), _M_nd()
3260 {
return _M_param.alpha(); }
3267 {
return _M_param.beta(); }
3274 {
return _M_param; }
3282 { _M_param = __param; }
3301 template<
typename _UniformRandomNumberGenerator>
3304 {
return this->
operator()(__urng, _M_param); }
3306 template<
typename _UniformRandomNumberGenerator>
3309 const param_type& __p);
3311 template<
typename _ForwardIterator,
3312 typename _UniformRandomNumberGenerator>
3314 __generate(_ForwardIterator __f, _ForwardIterator __t,
3315 _UniformRandomNumberGenerator& __urng)
3316 { this->__generate(__f, __t, __urng, _M_param); }
3318 template<
typename _ForwardIterator,
3319 typename _UniformRandomNumberGenerator>
3321 __generate(_ForwardIterator __f, _ForwardIterator __t,
3322 _UniformRandomNumberGenerator& __urng,
3323 const param_type& __p)
3324 { this->__generate_impl(__f, __t, __urng, __p); }
3326 template<
typename _UniformRandomNumberGenerator>
3328 __generate(result_type* __f, result_type* __t,
3329 _UniformRandomNumberGenerator& __urng,
3330 const param_type& __p)
3331 { this->__generate_impl(__f, __t, __urng, __p); }
3341 {
return (__d1._M_param == __d2._M_param
3342 && __d1._M_nd == __d2._M_nd); }
3354 template<
typename _RealType1,
typename _CharT,
typename _Traits>
3368 template<
typename _RealType1,
typename _CharT,
typename _Traits>
3374 template<
typename _ForwardIterator,
3375 typename _UniformRandomNumberGenerator>
3377 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
3378 _UniformRandomNumberGenerator& __urng,
3379 const param_type& __p);
3381 param_type _M_param;
3386#if __cpp_impl_three_way_comparison < 201907L
3390 template<
typename _RealType>
3394 {
return !(__d1 == __d2); }
3414 template<
typename _RealType =
double>
3415 class chi_squared_distribution
3418 "result_type must be a floating point type");
3427 typedef chi_squared_distribution<_RealType> distribution_type;
3429 param_type() : param_type(1) { }
3432 param_type(_RealType __n)
3441 operator==(
const param_type& __p1,
const param_type& __p2)
3442 {
return __p1._M_n == __p2._M_n; }
3444#if __cpp_impl_three_way_comparison < 201907L
3446 operator!=(
const param_type& __p1,
const param_type& __p2)
3447 {
return !(__p1 == __p2); }
3454 chi_squared_distribution() : chi_squared_distribution(1) { }
3458 : _M_param(__n), _M_gd(__n / 2)
3462 chi_squared_distribution(
const param_type& __p)
3463 : _M_param(__p), _M_gd(__p.n() / 2)
3478 {
return _M_param.n(); }
3485 {
return _M_param; }
3497 _M_gd.param(param_type{__param.n() / 2});
3517 template<
typename _UniformRandomNumberGenerator>
3520 {
return 2 * _M_gd(__urng); }
3522 template<
typename _UniformRandomNumberGenerator>
3524 operator()(_UniformRandomNumberGenerator& __urng,
3525 const param_type& __p)
3529 return 2 * _M_gd(__urng, param_type(__p.n() / 2));
3532 template<
typename _ForwardIterator,
3533 typename _UniformRandomNumberGenerator>
3535 __generate(_ForwardIterator __f, _ForwardIterator __t,
3536 _UniformRandomNumberGenerator& __urng)
3537 { this->__generate_impl(__f, __t, __urng); }
3539 template<
typename _ForwardIterator,
3540 typename _UniformRandomNumberGenerator>
3542 __generate(_ForwardIterator __f, _ForwardIterator __t,
3543 _UniformRandomNumberGenerator& __urng,
3545 {
typename std::gamma_distribution<result_type>::param_type
3547 this->__generate_impl(__f, __t, __urng, __p2); }
3549 template<
typename _UniformRandomNumberGenerator>
3552 _UniformRandomNumberGenerator& __urng)
3553 { this->__generate_impl(__f, __t, __urng); }
3555 template<
typename _UniformRandomNumberGenerator>
3558 _UniformRandomNumberGenerator& __urng,
3560 {
typename std::gamma_distribution<result_type>::param_type
3562 this->__generate_impl(__f, __t, __urng, __p2); }
3571 const chi_squared_distribution& __d2)
3572 {
return __d1._M_param == __d2._M_param && __d1._M_gd == __d2._M_gd; }
3584 template<
typename _RealType1,
typename _CharT,
typename _Traits>
3599 template<
typename _RealType1,
typename _CharT,
typename _Traits>
3605 template<
typename _ForwardIterator,
3606 typename _UniformRandomNumberGenerator>
3608 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
3609 _UniformRandomNumberGenerator& __urng);
3611 template<
typename _ForwardIterator,
3612 typename _UniformRandomNumberGenerator>
3614 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
3615 _UniformRandomNumberGenerator& __urng,
3619 param_type _M_param;
3624#if __cpp_impl_three_way_comparison < 201907L
3628 template<
typename _RealType>
3632 {
return !(__d1 == __d2); }
3644 template<
typename _RealType =
double>
3645 class cauchy_distribution
3648 "result_type must be a floating point type");
3657 typedef cauchy_distribution<_RealType> distribution_type;
3659 param_type() : param_type(0) { }
3662 param_type(_RealType __a, _RealType __b = _RealType(1))
3663 : _M_a(__a), _M_b(__b)
3675 operator==(
const param_type& __p1,
const param_type& __p2)
3676 {
return __p1._M_a == __p2._M_a && __p1._M_b == __p2._M_b; }
3678#if __cpp_impl_three_way_comparison < 201907L
3680 operator!=(
const param_type& __p1,
const param_type& __p2)
3681 {
return !(__p1 == __p2); }
3689 cauchy_distribution() : cauchy_distribution(0.0) { }
3693 : _M_param(__a, __b)
3697 cauchy_distribution(
const param_type& __p)
3713 {
return _M_param.a(); }
3717 {
return _M_param.b(); }
3724 {
return _M_param; }
3732 { _M_param = __param; }
3751 template<
typename _UniformRandomNumberGenerator>
3754 {
return this->
operator()(__urng, _M_param); }
3756 template<
typename _UniformRandomNumberGenerator>
3758 operator()(_UniformRandomNumberGenerator& __urng,
3759 const param_type& __p);
3761 template<
typename _ForwardIterator,
3762 typename _UniformRandomNumberGenerator>
3764 __generate(_ForwardIterator __f, _ForwardIterator __t,
3765 _UniformRandomNumberGenerator& __urng)
3766 { this->__generate(__f, __t, __urng, _M_param); }
3768 template<
typename _ForwardIterator,
3769 typename _UniformRandomNumberGenerator>
3771 __generate(_ForwardIterator __f, _ForwardIterator __t,
3772 _UniformRandomNumberGenerator& __urng,
3773 const param_type& __p)
3774 { this->__generate_impl(__f, __t, __urng, __p); }
3776 template<
typename _UniformRandomNumberGenerator>
3779 _UniformRandomNumberGenerator& __urng,
3781 { this->__generate_impl(__f, __t, __urng, __p); }
3789 const cauchy_distribution& __d2)
3790 {
return __d1._M_param == __d2._M_param; }
3793 template<
typename _ForwardIterator,
3794 typename _UniformRandomNumberGenerator>
3796 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
3797 _UniformRandomNumberGenerator& __urng,
3798 const param_type& __p);
3800 param_type _M_param;
3803#if __cpp_impl_three_way_comparison < 201907L
3808 template<
typename _RealType>
3812 {
return !(__d1 == __d2); }
3825 template<
typename _RealType,
typename _CharT,
typename _Traits>
3826 std::basic_ostream<_CharT, _Traits>&
3827 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
3828 const std::cauchy_distribution<_RealType>& __x);
3840 template<
typename _RealType,
typename _CharT,
typename _Traits>
3841 std::basic_istream<_CharT, _Traits>&
3842 operator>>(std::basic_istream<_CharT, _Traits>& __is,
3843 std::cauchy_distribution<_RealType>& __x);
3859 template<
typename _RealType =
double>
3860 class fisher_f_distribution
3863 "result_type must be a floating point type");
3872 typedef fisher_f_distribution<_RealType> distribution_type;
3874 param_type() : param_type(1) { }
3877 param_type(_RealType __m, _RealType __n = _RealType(1))
3878 : _M_m(__m), _M_n(__n)
3890 operator==(
const param_type& __p1,
const param_type& __p2)
3891 {
return __p1._M_m == __p2._M_m && __p1._M_n == __p2._M_n; }
3893#if __cpp_impl_three_way_comparison < 201907L
3895 operator!=(
const param_type& __p1,
const param_type& __p2)
3896 {
return !(__p1 == __p2); }
3904 fisher_f_distribution() : fisher_f_distribution(1.0) { }
3908 _RealType __n = _RealType(1))
3909 : _M_param(__m, __n), _M_gd_x(__m / 2), _M_gd_y(__n / 2)
3913 fisher_f_distribution(
const param_type& __p)
3914 : _M_param(__p), _M_gd_x(__p.m() / 2), _M_gd_y(__p.n() / 2)
3932 {
return _M_param.m(); }
3936 {
return _M_param.n(); }
3943 {
return _M_param; }
3951 { _M_param = __param; }
3970 template<
typename _UniformRandomNumberGenerator>
3973 {
return (_M_gd_x(__urng) * n()) / (_M_gd_y(__urng) * m()); }
3975 template<
typename _UniformRandomNumberGenerator>
3977 operator()(_UniformRandomNumberGenerator& __urng,
3978 const param_type& __p)
3982 return ((_M_gd_x(__urng, param_type(__p.m() / 2)) * n())
3983 / (_M_gd_y(__urng, param_type(__p.n() / 2)) * m()));
3986 template<
typename _ForwardIterator,
3987 typename _UniformRandomNumberGenerator>
3989 __generate(_ForwardIterator __f, _ForwardIterator __t,
3990 _UniformRandomNumberGenerator& __urng)
3991 { this->__generate_impl(__f, __t, __urng); }
3993 template<
typename _ForwardIterator,
3994 typename _UniformRandomNumberGenerator>
3996 __generate(_ForwardIterator __f, _ForwardIterator __t,
3997 _UniformRandomNumberGenerator& __urng,
3999 { this->__generate_impl(__f, __t, __urng, __p); }
4001 template<
typename _UniformRandomNumberGenerator>
4004 _UniformRandomNumberGenerator& __urng)
4005 { this->__generate_impl(__f, __t, __urng); }
4007 template<
typename _UniformRandomNumberGenerator>
4010 _UniformRandomNumberGenerator& __urng,
4012 { this->__generate_impl(__f, __t, __urng, __p); }
4021 const fisher_f_distribution& __d2)
4022 {
return (__d1._M_param == __d2._M_param
4023 && __d1._M_gd_x == __d2._M_gd_x
4024 && __d1._M_gd_y == __d2._M_gd_y); }
4036 template<
typename _RealType1,
typename _CharT,
typename _Traits>
4051 template<
typename _RealType1,
typename _CharT,
typename _Traits>
4057 template<
typename _ForwardIterator,
4058 typename _UniformRandomNumberGenerator>
4060 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
4061 _UniformRandomNumberGenerator& __urng);
4063 template<
typename _ForwardIterator,
4064 typename _UniformRandomNumberGenerator>
4066 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
4067 _UniformRandomNumberGenerator& __urng,
4068 const param_type& __p);
4070 param_type _M_param;
4075#if __cpp_impl_three_way_comparison < 201907L
4079 template<
typename _RealType>
4083 {
return !(__d1 == __d2); }
4098 template<
typename _RealType =
double>
4099 class student_t_distribution
4102 "result_type must be a floating point type");
4111 typedef student_t_distribution<_RealType> distribution_type;
4113 param_type() : param_type(1) { }
4116 param_type(_RealType __n)
4125 operator==(
const param_type& __p1,
const param_type& __p2)
4126 {
return __p1._M_n == __p2._M_n; }
4128#if __cpp_impl_three_way_comparison < 201907L
4130 operator!=(
const param_type& __p1,
const param_type& __p2)
4131 {
return !(__p1 == __p2); }
4138 student_t_distribution() : student_t_distribution(1.0) { }
4142 : _M_param(__n), _M_nd(), _M_gd(__n / 2, 2)
4146 student_t_distribution(
const param_type& __p)
4147 : _M_param(__p), _M_nd(), _M_gd(__p.n() / 2, 2)
4165 {
return _M_param.n(); }
4172 {
return _M_param; }
4180 { _M_param = __param; }
4199 template<
typename _UniformRandomNumberGenerator>
4202 {
return _M_nd(__urng) *
std::sqrt(n() / _M_gd(__urng)); }
4204 template<
typename _UniformRandomNumberGenerator>
4206 operator()(_UniformRandomNumberGenerator& __urng,
4207 const param_type& __p)
4212 const result_type __g = _M_gd(__urng, param_type(__p.n() / 2, 2));
4213 return _M_nd(__urng) *
std::sqrt(__p.n() / __g);
4216 template<
typename _ForwardIterator,
4217 typename _UniformRandomNumberGenerator>
4219 __generate(_ForwardIterator __f, _ForwardIterator __t,
4220 _UniformRandomNumberGenerator& __urng)
4221 { this->__generate_impl(__f, __t, __urng); }
4223 template<
typename _ForwardIterator,
4224 typename _UniformRandomNumberGenerator>
4226 __generate(_ForwardIterator __f, _ForwardIterator __t,
4227 _UniformRandomNumberGenerator& __urng,
4229 { this->__generate_impl(__f, __t, __urng, __p); }
4231 template<
typename _UniformRandomNumberGenerator>
4234 _UniformRandomNumberGenerator& __urng)
4235 { this->__generate_impl(__f, __t, __urng); }
4237 template<
typename _UniformRandomNumberGenerator>
4240 _UniformRandomNumberGenerator& __urng,
4242 { this->__generate_impl(__f, __t, __urng, __p); }
4251 const student_t_distribution& __d2)
4252 {
return (__d1._M_param == __d2._M_param
4253 && __d1._M_nd == __d2._M_nd && __d1._M_gd == __d2._M_gd); }
4265 template<
typename _RealType1,
typename _CharT,
typename _Traits>
4280 template<
typename _RealType1,
typename _CharT,
typename _Traits>
4286 template<
typename _ForwardIterator,
4287 typename _UniformRandomNumberGenerator>
4289 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
4290 _UniformRandomNumberGenerator& __urng);
4291 template<
typename _ForwardIterator,
4292 typename _UniformRandomNumberGenerator>
4294 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
4295 _UniformRandomNumberGenerator& __urng,
4296 const param_type& __p);
4298 param_type _M_param;
4304#if __cpp_impl_three_way_comparison < 201907L
4308 template<
typename _RealType>
4312 {
return !(__d1 == __d2); }
4343 param_type() : param_type(0.5) { }
4346 param_type(
double __p)
4349 __glibcxx_assert((_M_p >= 0.0) && (_M_p <= 1.0));
4357 operator==(
const param_type& __p1,
const param_type& __p2)
4358 {
return __p1._M_p == __p2._M_p; }
4360#if __cpp_impl_three_way_comparison < 201907L
4362 operator!=(
const param_type& __p1,
const param_type& __p2)
4363 {
return !(__p1 == __p2); }
4405 {
return _M_param.p(); }
4412 {
return _M_param; }
4420 { _M_param = __param; }
4439 template<
typename _UniformRandomNumberGenerator>
4442 {
return this->
operator()(__urng, _M_param); }
4444 template<
typename _UniformRandomNumberGenerator>
4446 operator()(_UniformRandomNumberGenerator& __urng,
4447 const param_type& __p)
4449 __detail::_Adaptor<_UniformRandomNumberGenerator, double>
4451 if ((__aurng() - __aurng.min())
4452 < __p.p() * (__aurng.max() - __aurng.min()))
4457 template<
typename _ForwardIterator,
4458 typename _UniformRandomNumberGenerator>
4460 __generate(_ForwardIterator __f, _ForwardIterator __t,
4461 _UniformRandomNumberGenerator& __urng)
4462 { this->__generate(__f, __t, __urng, _M_param); }
4464 template<
typename _ForwardIterator,
4465 typename _UniformRandomNumberGenerator>
4467 __generate(_ForwardIterator __f, _ForwardIterator __t,
4468 _UniformRandomNumberGenerator& __urng,
const param_type& __p)
4469 { this->__generate_impl(__f, __t, __urng, __p); }
4471 template<
typename _UniformRandomNumberGenerator>
4474 _UniformRandomNumberGenerator& __urng,
4476 { this->__generate_impl(__f, __t, __urng, __p); }
4485 {
return __d1._M_param == __d2._M_param; }
4488 template<
typename _ForwardIterator,
4489 typename _UniformRandomNumberGenerator>
4491 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
4492 _UniformRandomNumberGenerator& __urng,
4493 const param_type& __p);
4495 param_type _M_param;
4498#if __cpp_impl_three_way_comparison < 201907L
4506 {
return !(__d1 == __d2); }
4519 template<
typename _CharT,
typename _Traits>
4520 std::basic_ostream<_CharT, _Traits>&
4521 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
4522 const std::bernoulli_distribution& __x);
4533 template<
typename _CharT,
typename _Traits>
4534 inline std::basic_istream<_CharT, _Traits>&
4555 template<
typename _IntType =
int>
4556 class binomial_distribution
4559 "result_type must be an integral type");
4568 typedef binomial_distribution<_IntType> distribution_type;
4569 friend class binomial_distribution<_IntType>;
4571 param_type() : param_type(1) { }
4574 param_type(_IntType __t,
double __p = 0.5)
4575 : _M_t(__t), _M_p(__p)
4577 __glibcxx_assert((_M_t >= _IntType(0))
4592 operator==(
const param_type& __p1,
const param_type& __p2)
4593 {
return __p1._M_t == __p2._M_t && __p1._M_p == __p2._M_p; }
4595#if __cpp_impl_three_way_comparison < 201907L
4597 operator!=(
const param_type& __p1,
const param_type& __p2)
4598 {
return !(__p1 == __p2); }
4609#if _GLIBCXX_USE_C99_MATH_FUNCS
4610 double _M_d1, _M_d2, _M_s1, _M_s2, _M_c,
4611 _M_a1, _M_a123, _M_s, _M_lf, _M_lp1p;
4618 binomial_distribution() : binomial_distribution(1) { }
4622 : _M_param(__t, __p), _M_nd()
4626 binomial_distribution(
const param_type& __p)
4627 : _M_param(__p), _M_nd()
4642 {
return _M_param.t(); }
4649 {
return _M_param.p(); }
4656 {
return _M_param; }
4664 { _M_param = __param; }
4678 {
return _M_param.t(); }
4683 template<
typename _UniformRandomNumberGenerator>
4686 {
return this->
operator()(__urng, _M_param); }
4688 template<
typename _UniformRandomNumberGenerator>
4691 const param_type& __p);
4693 template<
typename _ForwardIterator,
4694 typename _UniformRandomNumberGenerator>
4696 __generate(_ForwardIterator __f, _ForwardIterator __t,
4697 _UniformRandomNumberGenerator& __urng)
4698 { this->__generate(__f, __t, __urng, _M_param); }
4700 template<
typename _ForwardIterator,
4701 typename _UniformRandomNumberGenerator>
4703 __generate(_ForwardIterator __f, _ForwardIterator __t,
4704 _UniformRandomNumberGenerator& __urng,
4705 const param_type& __p)
4706 { this->__generate_impl(__f, __t, __urng, __p); }
4708 template<
typename _UniformRandomNumberGenerator>
4710 __generate(result_type* __f, result_type* __t,
4711 _UniformRandomNumberGenerator& __urng,
4712 const param_type& __p)
4713 { this->__generate_impl(__f, __t, __urng, __p); }
4722 const binomial_distribution& __d2)
4723#ifdef _GLIBCXX_USE_C99_MATH_FUNCS
4724 {
return __d1._M_param == __d2._M_param && __d1._M_nd == __d2._M_nd; }
4726 {
return __d1._M_param == __d2._M_param; }
4739 template<
typename _IntType1,
4740 typename _CharT,
typename _Traits>
4755 template<
typename _IntType1,
4756 typename _CharT,
typename _Traits>
4762 template<
typename _ForwardIterator,
4763 typename _UniformRandomNumberGenerator>
4765 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
4766 _UniformRandomNumberGenerator& __urng,
4767 const param_type& __p);
4769 template<
typename _UniformRandomNumberGenerator>
4771 _M_waiting(_UniformRandomNumberGenerator& __urng,
4772 _IntType __t,
double __q);
4774 param_type _M_param;
4780#if __cpp_impl_three_way_comparison < 201907L
4784 template<
typename _IntType>
4788 {
return !(__d1 == __d2); }
4801 template<
typename _IntType =
int>
4802 class geometric_distribution
4805 "result_type must be an integral type");
4814 typedef geometric_distribution<_IntType> distribution_type;
4815 friend class geometric_distribution<_IntType>;
4817 param_type() : param_type(0.5) { }
4820 param_type(
double __p)
4823 __glibcxx_assert((_M_p > 0.0) && (_M_p < 1.0));
4832 operator==(
const param_type& __p1,
const param_type& __p2)
4833 {
return __p1._M_p == __p2._M_p; }
4835#if __cpp_impl_three_way_comparison < 201907L
4837 operator!=(
const param_type& __p1,
const param_type& __p2)
4838 {
return !(__p1 == __p2); }
4844 { _M_log_1_p =
std::log(1.0 - _M_p); }
4853 geometric_distribution() : geometric_distribution(0.5) { }
4861 geometric_distribution(
const param_type& __p)
4878 {
return _M_param.p(); }
4885 {
return _M_param; }
4893 { _M_param = __param; }
4912 template<
typename _UniformRandomNumberGenerator>
4915 {
return this->
operator()(__urng, _M_param); }
4917 template<
typename _UniformRandomNumberGenerator>
4919 operator()(_UniformRandomNumberGenerator& __urng,
4920 const param_type& __p);
4922 template<
typename _ForwardIterator,
4923 typename _UniformRandomNumberGenerator>
4925 __generate(_ForwardIterator __f, _ForwardIterator __t,
4926 _UniformRandomNumberGenerator& __urng)
4927 { this->__generate(__f, __t, __urng, _M_param); }
4929 template<
typename _ForwardIterator,
4930 typename _UniformRandomNumberGenerator>
4932 __generate(_ForwardIterator __f, _ForwardIterator __t,
4933 _UniformRandomNumberGenerator& __urng,
4934 const param_type& __p)
4935 { this->__generate_impl(__f, __t, __urng, __p); }
4937 template<
typename _UniformRandomNumberGenerator>
4940 _UniformRandomNumberGenerator& __urng,
4942 { this->__generate_impl(__f, __t, __urng, __p); }
4950 const geometric_distribution& __d2)
4951 {
return __d1._M_param == __d2._M_param; }
4954 template<
typename _ForwardIterator,
4955 typename _UniformRandomNumberGenerator>
4957 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
4958 _UniformRandomNumberGenerator& __urng,
4959 const param_type& __p);
4961 param_type _M_param;
4964#if __cpp_impl_three_way_comparison < 201907L
4969 template<
typename _IntType>
4973 {
return !(__d1 == __d2); }
4986 template<
typename _IntType,
4987 typename _CharT,
typename _Traits>
4988 std::basic_ostream<_CharT, _Traits>&
4989 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
4990 const std::geometric_distribution<_IntType>& __x);
5001 template<
typename _IntType,
5002 typename _CharT,
typename _Traits>
5003 std::basic_istream<_CharT, _Traits>&
5004 operator>>(std::basic_istream<_CharT, _Traits>& __is,
5005 std::geometric_distribution<_IntType>& __x);
5018 template<
typename _IntType =
int>
5019 class negative_binomial_distribution
5022 "result_type must be an integral type");
5031 typedef negative_binomial_distribution<_IntType> distribution_type;
5033 param_type() : param_type(1) { }
5036 param_type(_IntType __k,
double __p = 0.5)
5037 : _M_k(__k), _M_p(__p)
5039 __glibcxx_assert((_M_k > 0) && (_M_p > 0.0) && (_M_p <= 1.0));
5051 operator==(
const param_type& __p1,
const param_type& __p2)
5052 {
return __p1._M_k == __p2._M_k && __p1._M_p == __p2._M_p; }
5054#if __cpp_impl_three_way_comparison < 201907L
5056 operator!=(
const param_type& __p1,
const param_type& __p2)
5057 {
return !(__p1 == __p2); }
5065 negative_binomial_distribution() : negative_binomial_distribution(1) { }
5069 : _M_param(__k, __p), _M_gd(__k, (1.0 - __p) / __p)
5073 negative_binomial_distribution(
const param_type& __p)
5074 : _M_param(__p), _M_gd(__p.
k(), (1.0 - __p.
p()) / __p.
p())
5089 {
return _M_param.k(); }
5096 {
return _M_param.p(); }
5103 {
return _M_param; }
5111 { _M_param = __param; }
5130 template<
typename _UniformRandomNumberGenerator>
5134 template<
typename _UniformRandomNumberGenerator>
5136 operator()(_UniformRandomNumberGenerator& __urng,
5137 const param_type& __p);
5139 template<
typename _ForwardIterator,
5140 typename _UniformRandomNumberGenerator>
5142 __generate(_ForwardIterator __f, _ForwardIterator __t,
5143 _UniformRandomNumberGenerator& __urng)
5144 { this->__generate_impl(__f, __t, __urng); }
5146 template<
typename _ForwardIterator,
5147 typename _UniformRandomNumberGenerator>
5149 __generate(_ForwardIterator __f, _ForwardIterator __t,
5150 _UniformRandomNumberGenerator& __urng,
5151 const param_type& __p)
5152 { this->__generate_impl(__f, __t, __urng, __p); }
5154 template<
typename _UniformRandomNumberGenerator>
5156 __generate(result_type* __f, result_type* __t,
5157 _UniformRandomNumberGenerator& __urng)
5158 { this->__generate_impl(__f, __t, __urng); }
5160 template<
typename _UniformRandomNumberGenerator>
5163 _UniformRandomNumberGenerator& __urng,
5165 { this->__generate_impl(__f, __t, __urng, __p); }
5174 const negative_binomial_distribution& __d2)
5175 {
return __d1._M_param == __d2._M_param && __d1._M_gd == __d2._M_gd; }
5188 template<
typename _IntType1,
typename _CharT,
typename _Traits>
5203 template<
typename _IntType1,
typename _CharT,
typename _Traits>
5209 template<
typename _ForwardIterator,
5210 typename _UniformRandomNumberGenerator>
5212 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
5213 _UniformRandomNumberGenerator& __urng);
5214 template<
typename _ForwardIterator,
5215 typename _UniformRandomNumberGenerator>
5217 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
5218 _UniformRandomNumberGenerator& __urng,
5219 const param_type& __p);
5221 param_type _M_param;
5226#if __cpp_impl_three_way_comparison < 201907L
5230 template<
typename _IntType>
5234 {
return !(__d1 == __d2); }
5255 template<
typename _IntType =
int>
5256 class poisson_distribution
5259 "result_type must be an integral type");
5268 typedef poisson_distribution<_IntType> distribution_type;
5269 friend class poisson_distribution<_IntType>;
5271 param_type() : param_type(1.0) { }
5274 param_type(
double __mean)
5277 __glibcxx_assert(_M_mean > 0.0);
5286 operator==(
const param_type& __p1,
const param_type& __p2)
5287 {
return __p1._M_mean == __p2._M_mean; }
5289#if __cpp_impl_three_way_comparison < 201907L
5291 operator!=(
const param_type& __p1,
const param_type& __p2)
5292 {
return !(__p1 == __p2); }
5303#if _GLIBCXX_USE_C99_MATH_FUNCS
5304 double _M_lfm, _M_sm, _M_d, _M_scx, _M_1cx, _M_c2b, _M_cb;
5310 poisson_distribution() : poisson_distribution(1.0) { }
5314 : _M_param(__mean), _M_nd()
5318 poisson_distribution(
const param_type& __p)
5319 : _M_param(__p), _M_nd()
5334 {
return _M_param.mean(); }
5341 {
return _M_param; }
5349 { _M_param = __param; }
5368 template<
typename _UniformRandomNumberGenerator>
5371 {
return this->
operator()(__urng, _M_param); }
5373 template<
typename _UniformRandomNumberGenerator>
5376 const param_type& __p);
5378 template<
typename _ForwardIterator,
5379 typename _UniformRandomNumberGenerator>
5381 __generate(_ForwardIterator __f, _ForwardIterator __t,
5382 _UniformRandomNumberGenerator& __urng)
5383 { this->__generate(__f, __t, __urng, _M_param); }
5385 template<
typename _ForwardIterator,
5386 typename _UniformRandomNumberGenerator>
5388 __generate(_ForwardIterator __f, _ForwardIterator __t,
5389 _UniformRandomNumberGenerator& __urng,
5390 const param_type& __p)
5391 { this->__generate_impl(__f, __t, __urng, __p); }
5393 template<
typename _UniformRandomNumberGenerator>
5395 __generate(result_type* __f, result_type* __t,
5396 _UniformRandomNumberGenerator& __urng,
5397 const param_type& __p)
5398 { this->__generate_impl(__f, __t, __urng, __p); }
5407 const poisson_distribution& __d2)
5408#ifdef _GLIBCXX_USE_C99_MATH_FUNCS
5409 {
return __d1._M_param == __d2._M_param && __d1._M_nd == __d2._M_nd; }
5411 {
return __d1._M_param == __d2._M_param; }
5424 template<
typename _IntType1,
typename _CharT,
typename _Traits>
5439 template<
typename _IntType1,
typename _CharT,
typename _Traits>
5445 template<
typename _ForwardIterator,
5446 typename _UniformRandomNumberGenerator>
5448 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
5449 _UniformRandomNumberGenerator& __urng,
5450 const param_type& __p);
5452 param_type _M_param;
5458#if __cpp_impl_three_way_comparison < 201907L
5462 template<
typename _IntType>
5466 {
return !(__d1 == __d2); }
5487 template<
typename _RealType =
double>
5491 "result_type must be a floating point type");
5502 param_type() : param_type(1.0) { }
5505 param_type(_RealType __lambda)
5506 : _M_lambda(__lambda)
5508 __glibcxx_assert(_M_lambda > _RealType(0));
5513 {
return _M_lambda; }
5516 operator==(
const param_type& __p1,
const param_type& __p2)
5517 {
return __p1._M_lambda == __p2._M_lambda; }
5519#if __cpp_impl_three_way_comparison < 201907L
5521 operator!=(
const param_type& __p1,
const param_type& __p2)
5522 {
return !(__p1 == __p2); }
5526 _RealType _M_lambda;
5542 : _M_param(__lambda)
5563 {
return _M_param.lambda(); }
5570 {
return _M_param; }
5578 { _M_param = __param; }
5597 template<
typename _UniformRandomNumberGenerator>
5600 {
return this->
operator()(__urng, _M_param); }
5602 template<
typename _UniformRandomNumberGenerator>
5604 operator()(_UniformRandomNumberGenerator& __urng,
5605 const param_type& __p)
5607 __detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
5612 template<
typename _ForwardIterator,
5613 typename _UniformRandomNumberGenerator>
5615 __generate(_ForwardIterator __f, _ForwardIterator __t,
5616 _UniformRandomNumberGenerator& __urng)
5617 { this->__generate(__f, __t, __urng, _M_param); }
5619 template<
typename _ForwardIterator,
5620 typename _UniformRandomNumberGenerator>
5622 __generate(_ForwardIterator __f, _ForwardIterator __t,
5623 _UniformRandomNumberGenerator& __urng,
5625 { this->__generate_impl(__f, __t, __urng, __p); }
5627 template<
typename _UniformRandomNumberGenerator>
5630 _UniformRandomNumberGenerator& __urng,
5632 { this->__generate_impl(__f, __t, __urng, __p); }
5641 {
return __d1._M_param == __d2._M_param; }
5644 template<
typename _ForwardIterator,
5645 typename _UniformRandomNumberGenerator>
5647 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
5648 _UniformRandomNumberGenerator& __urng,
5649 const param_type& __p);
5651 param_type _M_param;
5654#if __cpp_impl_three_way_comparison < 201907L
5659 template<
typename _RealType>
5663 {
return !(__d1 == __d2); }
5676 template<
typename _RealType,
typename _CharT,
typename _Traits>
5677 std::basic_ostream<_CharT, _Traits>&
5678 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
5679 const std::exponential_distribution<_RealType>& __x);
5691 template<
typename _RealType,
typename _CharT,
typename _Traits>
5692 std::basic_istream<_CharT, _Traits>&
5693 operator>>(std::basic_istream<_CharT, _Traits>& __is,
5694 std::exponential_distribution<_RealType>& __x);
5709 template<
typename _RealType =
double>
5710 class weibull_distribution
5713 "result_type must be a floating point type");
5722 typedef weibull_distribution<_RealType> distribution_type;
5724 param_type() : param_type(1.0) { }
5727 param_type(_RealType __a, _RealType __b = _RealType(1.0))
5728 : _M_a(__a), _M_b(__b)
5740 operator==(
const param_type& __p1,
const param_type& __p2)
5741 {
return __p1._M_a == __p2._M_a && __p1._M_b == __p2._M_b; }
5743#if __cpp_impl_three_way_comparison < 201907L
5745 operator!=(
const param_type& __p1,
const param_type& __p2)
5746 {
return !(__p1 == __p2); }
5754 weibull_distribution() : weibull_distribution(1.0) { }
5758 : _M_param(__a, __b)
5762 weibull_distribution(
const param_type& __p)
5778 {
return _M_param.a(); }
5785 {
return _M_param.b(); }
5792 {
return _M_param; }
5800 { _M_param = __param; }
5819 template<
typename _UniformRandomNumberGenerator>
5822 {
return this->
operator()(__urng, _M_param); }
5824 template<
typename _UniformRandomNumberGenerator>
5826 operator()(_UniformRandomNumberGenerator& __urng,
5827 const param_type& __p);
5829 template<
typename _ForwardIterator,
5830 typename _UniformRandomNumberGenerator>
5832 __generate(_ForwardIterator __f, _ForwardIterator __t,
5833 _UniformRandomNumberGenerator& __urng)
5834 { this->__generate(__f, __t, __urng, _M_param); }
5836 template<
typename _ForwardIterator,
5837 typename _UniformRandomNumberGenerator>
5839 __generate(_ForwardIterator __f, _ForwardIterator __t,
5840 _UniformRandomNumberGenerator& __urng,
5841 const param_type& __p)
5842 { this->__generate_impl(__f, __t, __urng, __p); }
5844 template<
typename _UniformRandomNumberGenerator>
5847 _UniformRandomNumberGenerator& __urng,
5849 { this->__generate_impl(__f, __t, __urng, __p); }
5857 const weibull_distribution& __d2)
5858 {
return __d1._M_param == __d2._M_param; }
5861 template<
typename _ForwardIterator,
5862 typename _UniformRandomNumberGenerator>
5864 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
5865 _UniformRandomNumberGenerator& __urng,
5866 const param_type& __p);
5868 param_type _M_param;
5871#if __cpp_impl_three_way_comparison < 201907L
5876 template<
typename _RealType>
5880 {
return !(__d1 == __d2); }
5893 template<
typename _RealType,
typename _CharT,
typename _Traits>
5894 std::basic_ostream<_CharT, _Traits>&
5895 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
5896 const std::weibull_distribution<_RealType>& __x);
5908 template<
typename _RealType,
typename _CharT,
typename _Traits>
5909 std::basic_istream<_CharT, _Traits>&
5910 operator>>(std::basic_istream<_CharT, _Traits>& __is,
5911 std::weibull_distribution<_RealType>& __x);
5926 template<
typename _RealType =
double>
5927 class extreme_value_distribution
5930 "result_type must be a floating point type");
5939 typedef extreme_value_distribution<_RealType> distribution_type;
5941 param_type() : param_type(0.0) { }
5944 param_type(_RealType __a, _RealType __b = _RealType(1.0))
5945 : _M_a(__a), _M_b(__b)
5957 operator==(
const param_type& __p1,
const param_type& __p2)
5958 {
return __p1._M_a == __p2._M_a && __p1._M_b == __p2._M_b; }
5960#if __cpp_impl_three_way_comparison < 201907L
5962 operator!=(
const param_type& __p1,
const param_type& __p2)
5963 {
return !(__p1 == __p2); }
5971 extreme_value_distribution() : extreme_value_distribution(0.0) { }
5975 : _M_param(__a, __b)
5979 extreme_value_distribution(
const param_type& __p)
5995 {
return _M_param.a(); }
6002 {
return _M_param.b(); }
6009 {
return _M_param; }
6017 { _M_param = __param; }
6036 template<
typename _UniformRandomNumberGenerator>
6039 {
return this->
operator()(__urng, _M_param); }
6041 template<
typename _UniformRandomNumberGenerator>
6043 operator()(_UniformRandomNumberGenerator& __urng,
6044 const param_type& __p);
6046 template<
typename _ForwardIterator,
6047 typename _UniformRandomNumberGenerator>
6049 __generate(_ForwardIterator __f, _ForwardIterator __t,
6050 _UniformRandomNumberGenerator& __urng)
6051 { this->__generate(__f, __t, __urng, _M_param); }
6053 template<
typename _ForwardIterator,
6054 typename _UniformRandomNumberGenerator>
6056 __generate(_ForwardIterator __f, _ForwardIterator __t,
6057 _UniformRandomNumberGenerator& __urng,
6058 const param_type& __p)
6059 { this->__generate_impl(__f, __t, __urng, __p); }
6061 template<
typename _UniformRandomNumberGenerator>
6064 _UniformRandomNumberGenerator& __urng,
6066 { this->__generate_impl(__f, __t, __urng, __p); }
6074 const extreme_value_distribution& __d2)
6075 {
return __d1._M_param == __d2._M_param; }
6078 template<
typename _ForwardIterator,
6079 typename _UniformRandomNumberGenerator>
6081 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
6082 _UniformRandomNumberGenerator& __urng,
6083 const param_type& __p);
6085 param_type _M_param;
6088#if __cpp_impl_three_way_comparison < 201907L
6093 template<
typename _RealType>
6097 {
return !(__d1 == __d2); }
6110 template<
typename _RealType,
typename _CharT,
typename _Traits>
6111 std::basic_ostream<_CharT, _Traits>&
6112 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
6113 const std::extreme_value_distribution<_RealType>& __x);
6125 template<
typename _RealType,
typename _CharT,
typename _Traits>
6126 std::basic_istream<_CharT, _Traits>&
6127 operator>>(std::basic_istream<_CharT, _Traits>& __is,
6128 std::extreme_value_distribution<_RealType>& __x);
6148 template<
typename _IntType =
int>
6149 class discrete_distribution
6152 "result_type must be an integral type");
6161 typedef discrete_distribution<_IntType> distribution_type;
6162 friend class discrete_distribution<_IntType>;
6165 : _M_prob(), _M_cp()
6168 template<
typename _InputIterator>
6169 param_type(_InputIterator __wbegin,
6170 _InputIterator __wend)
6171 : _M_prob(__wbegin, __wend), _M_cp()
6172 { _M_initialize(); }
6175 : _M_prob(__wil.begin(), __wil.end()), _M_cp()
6176 { _M_initialize(); }
6178 template<
typename _Func>
6179 param_type(
size_t __nw,
double __xmin,
double __xmax,
6183 param_type(
const param_type&) =
default;
6184 param_type& operator=(
const param_type&) =
default;
6191 operator==(
const param_type& __p1,
const param_type& __p2)
6192 {
return __p1._M_prob == __p2._M_prob; }
6194#if __cpp_impl_three_way_comparison < 201907L
6196 operator!=(
const param_type& __p1,
const param_type& __p2)
6197 {
return !(__p1 == __p2); }
6208 discrete_distribution()
6212 template<
typename _InputIterator>
6214 _InputIterator __wend)
6215 : _M_param(__wbegin, __wend)
6218 discrete_distribution(initializer_list<double> __wl)
6222 template<
typename _Func>
6223 discrete_distribution(
size_t __nw,
double __xmin,
double __xmax,
6225 : _M_param(__nw, __xmin, __xmax, __fw)
6246 return _M_param._M_prob.
empty()
6255 {
return _M_param; }
6263 { _M_param = __param; }
6278 return _M_param._M_prob.empty()
6285 template<
typename _UniformRandomNumberGenerator>
6288 {
return this->
operator()(__urng, _M_param); }
6290 template<
typename _UniformRandomNumberGenerator>
6292 operator()(_UniformRandomNumberGenerator& __urng,
6293 const param_type& __p);
6295 template<
typename _ForwardIterator,
6296 typename _UniformRandomNumberGenerator>
6298 __generate(_ForwardIterator __f, _ForwardIterator __t,
6299 _UniformRandomNumberGenerator& __urng)
6300 { this->__generate(__f, __t, __urng, _M_param); }
6302 template<
typename _ForwardIterator,
6303 typename _UniformRandomNumberGenerator>
6305 __generate(_ForwardIterator __f, _ForwardIterator __t,
6306 _UniformRandomNumberGenerator& __urng,
6307 const param_type& __p)
6308 { this->__generate_impl(__f, __t, __urng, __p); }
6310 template<
typename _UniformRandomNumberGenerator>
6313 _UniformRandomNumberGenerator& __urng,
6315 { this->__generate_impl(__f, __t, __urng, __p); }
6323 const discrete_distribution& __d2)
6324 {
return __d1._M_param == __d2._M_param; }
6336 template<
typename _IntType1,
typename _CharT,
typename _Traits>
6352 template<
typename _IntType1,
typename _CharT,
typename _Traits>
6358 template<
typename _ForwardIterator,
6359 typename _UniformRandomNumberGenerator>
6361 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
6362 _UniformRandomNumberGenerator& __urng,
6363 const param_type& __p);
6365 param_type _M_param;
6368#if __cpp_impl_three_way_comparison < 201907L
6373 template<
typename _IntType>
6377 {
return !(__d1 == __d2); }
6396 template<
typename _RealType =
double>
6397 class piecewise_constant_distribution
6400 "result_type must be a floating point type");
6409 typedef piecewise_constant_distribution<_RealType> distribution_type;
6410 friend class piecewise_constant_distribution<_RealType>;
6413 : _M_int(), _M_den(), _M_cp()
6416 template<
typename _InputIteratorB,
typename _InputIteratorW>
6417 param_type(_InputIteratorB __bfirst,
6418 _InputIteratorB __bend,
6419 _InputIteratorW __wbegin);
6421 template<
typename _Func>
6424 template<
typename _Func>
6425 param_type(
size_t __nw, _RealType __xmin, _RealType __xmax,
6429 param_type(
const param_type&) =
default;
6430 param_type& operator=(
const param_type&) =
default;
6438 __tmp[1] = _RealType(1);
6450 operator==(
const param_type& __p1,
const param_type& __p2)
6451 {
return __p1._M_int == __p2._M_int && __p1._M_den == __p2._M_den; }
6453#if __cpp_impl_three_way_comparison < 201907L
6455 operator!=(
const param_type& __p1,
const param_type& __p2)
6456 {
return !(__p1 == __p2); }
6468 piecewise_constant_distribution()
6472 template<
typename _InputIteratorB,
typename _InputIteratorW>
6474 _InputIteratorB __bend,
6475 _InputIteratorW __wbegin)
6476 : _M_param(__bfirst, __bend, __wbegin)
6479 template<
typename _Func>
6480 piecewise_constant_distribution(initializer_list<_RealType> __bl,
6482 : _M_param(__bl, __fw)
6485 template<
typename _Func>
6486 piecewise_constant_distribution(
size_t __nw,
6487 _RealType __xmin, _RealType __xmax,
6489 : _M_param(__nw, __xmin, __xmax, __fw)
6493 piecewise_constant_distribution(
const param_type& __p)
6510 if (_M_param._M_int.empty())
6513 __tmp[1] = _RealType(1);
6517 return _M_param._M_int;
6526 return _M_param._M_den.
empty()
6535 {
return _M_param; }
6543 { _M_param = __param; }
6551 return _M_param._M_int.empty()
6561 return _M_param._M_int.empty()
6568 template<
typename _UniformRandomNumberGenerator>
6571 {
return this->
operator()(__urng, _M_param); }
6573 template<
typename _UniformRandomNumberGenerator>
6575 operator()(_UniformRandomNumberGenerator& __urng,
6576 const param_type& __p);
6578 template<
typename _ForwardIterator,
6579 typename _UniformRandomNumberGenerator>
6581 __generate(_ForwardIterator __f, _ForwardIterator __t,
6582 _UniformRandomNumberGenerator& __urng)
6583 { this->__generate(__f, __t, __urng, _M_param); }
6585 template<
typename _ForwardIterator,
6586 typename _UniformRandomNumberGenerator>
6588 __generate(_ForwardIterator __f, _ForwardIterator __t,
6589 _UniformRandomNumberGenerator& __urng,
6590 const param_type& __p)
6591 { this->__generate_impl(__f, __t, __urng, __p); }
6593 template<
typename _UniformRandomNumberGenerator>
6596 _UniformRandomNumberGenerator& __urng,
6598 { this->__generate_impl(__f, __t, __urng, __p); }
6606 const piecewise_constant_distribution& __d2)
6607 {
return __d1._M_param == __d2._M_param; }
6620 template<
typename _RealType1,
typename _CharT,
typename _Traits>
6636 template<
typename _RealType1,
typename _CharT,
typename _Traits>
6642 template<
typename _ForwardIterator,
6643 typename _UniformRandomNumberGenerator>
6645 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
6646 _UniformRandomNumberGenerator& __urng,
6647 const param_type& __p);
6649 param_type _M_param;
6652#if __cpp_impl_three_way_comparison < 201907L
6657 template<
typename _RealType>
6661 {
return !(__d1 == __d2); }
6676 template<
typename _RealType =
double>
6677 class piecewise_linear_distribution
6680 "result_type must be a floating point type");
6689 typedef piecewise_linear_distribution<_RealType> distribution_type;
6690 friend class piecewise_linear_distribution<_RealType>;
6693 : _M_int(), _M_den(), _M_cp(), _M_m()
6696 template<
typename _InputIteratorB,
typename _InputIteratorW>
6697 param_type(_InputIteratorB __bfirst,
6698 _InputIteratorB __bend,
6699 _InputIteratorW __wbegin);
6701 template<
typename _Func>
6704 template<
typename _Func>
6705 param_type(
size_t __nw, _RealType __xmin, _RealType __xmax,
6709 param_type(
const param_type&) =
default;
6710 param_type& operator=(
const param_type&) =
default;
6718 __tmp[1] = _RealType(1);
6730 operator==(
const param_type& __p1,
const param_type& __p2)
6731 {
return __p1._M_int == __p2._M_int && __p1._M_den == __p2._M_den; }
6733#if __cpp_impl_three_way_comparison < 201907L
6735 operator!=(
const param_type& __p1,
const param_type& __p2)
6736 {
return !(__p1 == __p2); }
6749 piecewise_linear_distribution()
6753 template<
typename _InputIteratorB,
typename _InputIteratorW>
6755 _InputIteratorB __bend,
6756 _InputIteratorW __wbegin)
6757 : _M_param(__bfirst, __bend, __wbegin)
6760 template<
typename _Func>
6761 piecewise_linear_distribution(initializer_list<_RealType> __bl,
6763 : _M_param(__bl, __fw)
6766 template<
typename _Func>
6767 piecewise_linear_distribution(
size_t __nw,
6768 _RealType __xmin, _RealType __xmax,
6770 : _M_param(__nw, __xmin, __xmax, __fw)
6774 piecewise_linear_distribution(
const param_type& __p)
6791 if (_M_param._M_int.empty())
6794 __tmp[1] = _RealType(1);
6798 return _M_param._M_int;
6808 return _M_param._M_den.
empty()
6817 {
return _M_param; }
6825 { _M_param = __param; }
6833 return _M_param._M_int.empty()
6843 return _M_param._M_int.empty()
6850 template<
typename _UniformRandomNumberGenerator>
6853 {
return this->
operator()(__urng, _M_param); }
6855 template<
typename _UniformRandomNumberGenerator>
6857 operator()(_UniformRandomNumberGenerator& __urng,
6858 const param_type& __p);
6860 template<
typename _ForwardIterator,
6861 typename _UniformRandomNumberGenerator>
6863 __generate(_ForwardIterator __f, _ForwardIterator __t,
6864 _UniformRandomNumberGenerator& __urng)
6865 { this->__generate(__f, __t, __urng, _M_param); }
6867 template<
typename _ForwardIterator,
6868 typename _UniformRandomNumberGenerator>
6870 __generate(_ForwardIterator __f, _ForwardIterator __t,
6871 _UniformRandomNumberGenerator& __urng,
6872 const param_type& __p)
6873 { this->__generate_impl(__f, __t, __urng, __p); }
6875 template<
typename _UniformRandomNumberGenerator>
6878 _UniformRandomNumberGenerator& __urng,
6880 { this->__generate_impl(__f, __t, __urng, __p); }
6888 const piecewise_linear_distribution& __d2)
6889 {
return __d1._M_param == __d2._M_param; }
6902 template<
typename _RealType1,
typename _CharT,
typename _Traits>
6918 template<
typename _RealType1,
typename _CharT,
typename _Traits>
6924 template<
typename _ForwardIterator,
6925 typename _UniformRandomNumberGenerator>
6927 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
6928 _UniformRandomNumberGenerator& __urng,
6929 const param_type& __p);
6931 param_type _M_param;
6934#if __cpp_impl_three_way_comparison < 201907L
6939 template<
typename _RealType>
6943 {
return !(__d1 == __d2); }
6974 template<
typename _IntType,
typename = _Require<is_
integral<_IntType>>>
6977 template<
typename _InputIterator>
6978 seed_seq(_InputIterator __begin, _InputIterator __end);
6981 template<
typename _RandomAccessIterator>
6983 generate(_RandomAccessIterator __begin, _RandomAccessIterator __end);
6986 size_t size() const noexcept
6987 {
return _M_v.
size(); }
6989 template<
typename _OutputIterator>
6991 param(_OutputIterator __dest)
const
6992 { std::copy(_M_v.
begin(), _M_v.
end(), __dest); }
6999 std::vector<result_type> _M_v;
7006_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.
constexpr complex< _Tp > operator-(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x minus 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.
constexpr complex< _Tp > operator/(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x divided by y.
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.
constexpr bitset< _Nb > operator^(const bitset< _Nb > &__x, const bitset< _Nb > &__y) noexcept
Global bitwise operations on bitsets.
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.
constexpr bitset< _Nb > operator|(const bitset< _Nb > &__x, const bitset< _Nb > &__y) noexcept
Global bitwise operations on bitsets.
constexpr bitset< _Nb > operator&(const bitset< _Nb > &__x, const bitset< _Nb > &__y) noexcept
Global bitwise operations on 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