35namespace std _GLIBCXX_VISIBILITY(default)
37_GLIBCXX_BEGIN_NAMESPACE_VERSION
49 template<
typename _Tp, _Tp __m, _Tp __a, _Tp __c>
51 _Mod<_Tp, __m, __a, __c, false, true>::
58 static const _Tp __q = __m / __a;
59 static const _Tp __r = __m % __a;
61 _Tp __t1 = __a * (__x % __q);
62 _Tp __t2 = __r * (__x / __q);
66 __x = __m - __t2 + __t1;
71 const _Tp __d = __m - __x;
80 template<
typename _InputIterator,
typename _OutputIterator,
83 __normalize(_InputIterator __first, _InputIterator __last,
84 _OutputIterator __result,
const _Tp& __factor)
86 for (; __first != __last; ++__first, ++__result)
87 *__result = *__first / __factor;
94#if ! __cpp_inline_variables
95 template<
typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
99 template<
typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
103 template<
typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
107 template<
typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
109 linear_congruential_engine<_UIntType, __a, __c, __m>::default_seed;
116 template<
typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
121 if ((__detail::__mod<_UIntType, __m>(__c) == 0)
122 && (__detail::__mod<_UIntType, __m>(
__s) == 0))
125 _M_x = __detail::__mod<_UIntType, __m>(
__s);
131 template<
typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
132 template<
typename _Sseq>
140 const _UIntType
__k = (
__k0 + 31) / 32;
145 for (
size_t __j = 0; __j <
__k; ++__j)
148 __factor *= __detail::_Shift<_UIntType, 32>::__value;
153 template<
typename _UIntType, _UIntType __a, _UIntType __c, _UIntType
__m,
154 typename _CharT,
typename _Traits>
162 const typename __ios_base::fmtflags __flags =
__os.flags();
163 const _CharT __fill =
__os.fill();
164 __os.flags(__ios_base::dec | __ios_base::fixed | __ios_base::left);
174 template<
typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m,
175 typename _CharT,
typename _Traits>
178 linear_congruential_engine<_UIntType, __a, __c, __m>& __lcr)
180 using __ios_base =
typename basic_istream<_CharT, _Traits>::ios_base;
182 const typename __ios_base::fmtflags __flags = __is.flags();
183 __is.flags(__ios_base::dec);
191#if ! __cpp_inline_variables
192 template<
typename _UIntType,
193 size_t __w,
size_t __n,
size_t __m,
size_t __r,
194 _UIntType __a,
size_t __u, _UIntType __d,
size_t __s,
195 _UIntType __b,
size_t __t, _UIntType __c,
size_t __l,
198 mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
199 __s, __b, __t, __c, __l, __f>::word_size;
201 template<
typename _UIntType,
202 size_t __w,
size_t __n,
size_t __m,
size_t __r,
203 _UIntType __a,
size_t __u, _UIntType __d,
size_t __s,
204 _UIntType __b,
size_t __t, _UIntType __c,
size_t __l,
207 mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
208 __s, __b, __t, __c, __l, __f>::state_size;
210 template<
typename _UIntType,
211 size_t __w,
size_t __n,
size_t __m,
size_t __r,
212 _UIntType __a,
size_t __u, _UIntType __d,
size_t __s,
213 _UIntType __b,
size_t __t, _UIntType __c,
size_t __l,
216 mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
217 __s, __b, __t, __c, __l, __f>::shift_size;
219 template<
typename _UIntType,
220 size_t __w,
size_t __n,
size_t __m,
size_t __r,
221 _UIntType __a,
size_t __u, _UIntType __d,
size_t __s,
222 _UIntType __b,
size_t __t, _UIntType __c,
size_t __l,
225 mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
226 __s, __b, __t, __c, __l, __f>::mask_bits;
228 template<
typename _UIntType,
229 size_t __w,
size_t __n,
size_t __m,
size_t __r,
230 _UIntType __a,
size_t __u, _UIntType __d,
size_t __s,
231 _UIntType __b,
size_t __t, _UIntType __c,
size_t __l,
234 mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
235 __s, __b, __t, __c, __l, __f>::xor_mask;
237 template<
typename _UIntType,
238 size_t __w,
size_t __n,
size_t __m,
size_t __r,
239 _UIntType __a,
size_t __u, _UIntType __d,
size_t __s,
240 _UIntType __b,
size_t __t, _UIntType __c,
size_t __l,
243 mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
244 __s, __b, __t, __c, __l, __f>::tempering_u;
246 template<
typename _UIntType,
247 size_t __w,
size_t __n,
size_t __m,
size_t __r,
248 _UIntType __a,
size_t __u, _UIntType __d,
size_t __s,
249 _UIntType __b,
size_t __t, _UIntType __c,
size_t __l,
252 mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
253 __s, __b, __t, __c, __l, __f>::tempering_d;
255 template<
typename _UIntType,
256 size_t __w,
size_t __n,
size_t __m,
size_t __r,
257 _UIntType __a,
size_t __u, _UIntType __d,
size_t __s,
258 _UIntType __b,
size_t __t, _UIntType __c,
size_t __l,
261 mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
262 __s, __b, __t, __c, __l, __f>::tempering_s;
264 template<
typename _UIntType,
265 size_t __w,
size_t __n,
size_t __m,
size_t __r,
266 _UIntType __a,
size_t __u, _UIntType __d,
size_t __s,
267 _UIntType __b,
size_t __t, _UIntType __c,
size_t __l,
270 mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
271 __s, __b, __t, __c, __l, __f>::tempering_b;
273 template<
typename _UIntType,
274 size_t __w,
size_t __n,
size_t __m,
size_t __r,
275 _UIntType __a,
size_t __u, _UIntType __d,
size_t __s,
276 _UIntType __b,
size_t __t, _UIntType __c,
size_t __l,
279 mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
280 __s, __b, __t, __c, __l, __f>::tempering_t;
282 template<
typename _UIntType,
283 size_t __w,
size_t __n,
size_t __m,
size_t __r,
284 _UIntType __a,
size_t __u, _UIntType __d,
size_t __s,
285 _UIntType __b,
size_t __t, _UIntType __c,
size_t __l,
288 mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
289 __s, __b, __t, __c, __l, __f>::tempering_c;
291 template<
typename _UIntType,
292 size_t __w,
size_t __n,
size_t __m,
size_t __r,
293 _UIntType __a,
size_t __u, _UIntType __d,
size_t __s,
294 _UIntType __b,
size_t __t, _UIntType __c,
size_t __l,
297 mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
298 __s, __b, __t, __c, __l, __f>::tempering_l;
300 template<
typename _UIntType,
301 size_t __w,
size_t __n,
size_t __m,
size_t __r,
302 _UIntType __a,
size_t __u, _UIntType __d,
size_t __s,
303 _UIntType __b,
size_t __t, _UIntType __c,
size_t __l,
306 mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
307 __s, __b, __t, __c, __l, __f>::
308 initialization_multiplier;
310 template<
typename _UIntType,
311 size_t __w,
size_t __n,
size_t __m,
size_t __r,
312 _UIntType __a,
size_t __u, _UIntType __d,
size_t __s,
313 _UIntType __b,
size_t __t, _UIntType __c,
size_t __l,
316 mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
317 __s, __b, __t, __c, __l, __f>::default_seed;
320 template<
typename _UIntType,
321 size_t __w,
size_t __n,
size_t __m,
size_t __r,
322 _UIntType __a,
size_t __u, _UIntType __d,
size_t __s,
323 _UIntType __b,
size_t __t, _UIntType __c,
size_t __l,
326 mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
327 __s, __b, __t, __c, __l, __f>::
328 seed(result_type __sd)
330 _M_x[0] = __detail::__mod<_UIntType,
331 __detail::_Shift<_UIntType, __w>::__value>(__sd);
333 for (
size_t __i = 1; __i < state_size; ++__i)
335 _UIntType __x = _M_x[__i - 1];
336 __x ^= __x >> (__w - 2);
338 __x += __detail::__mod<_UIntType, __n>(__i);
339 _M_x[__i] = __detail::__mod<_UIntType,
340 __detail::_Shift<_UIntType, __w>::__value>(__x);
345 template<
typename _UIntType,
346 size_t __w,
size_t __n,
size_t __m,
size_t __r,
347 _UIntType __a,
size_t __u, _UIntType __d,
size_t __s,
348 _UIntType __b,
size_t __t, _UIntType __c,
size_t __l,
350 template<
typename _Sseq>
352 mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
353 __s, __b, __t, __c, __l, __f>::
355 -> _If_seed_seq<_Sseq>
357 const _UIntType __upper_mask = (~_UIntType()) << __r;
358 const size_t __k = (__w + 31) / 32;
359 uint_least32_t __arr[__n * __k];
360 __q.generate(__arr + 0, __arr + __n * __k);
363 for (
size_t __i = 0; __i < state_size; ++__i)
365 _UIntType __factor = 1u;
366 _UIntType __sum = 0u;
367 for (
size_t __j = 0; __j < __k; ++__j)
369 __sum += __arr[__k * __i + __j] * __factor;
370 __factor *= __detail::_Shift<_UIntType, 32>::__value;
372 _M_x[__i] = __detail::__mod<_UIntType,
373 __detail::_Shift<_UIntType, __w>::__value>(__sum);
379 if ((_M_x[0] & __upper_mask) != 0u)
382 else if (_M_x[__i] != 0u)
387 _M_x[0] = __detail::_Shift<_UIntType, __w - 1>::__value;
391 template<
typename _UIntType,
size_t __w,
392 size_t __n,
size_t __m,
size_t __r,
393 _UIntType __a,
size_t __u, _UIntType __d,
size_t __s,
394 _UIntType __b,
size_t __t, _UIntType __c,
size_t __l,
397 mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
398 __s, __b, __t, __c, __l, __f>::
401 const _UIntType __upper_mask = (~_UIntType()) << __r;
402 const _UIntType __lower_mask = ~__upper_mask;
404 for (
size_t __k = 0; __k < (__n - __m); ++__k)
406 _UIntType __y = ((_M_x[__k] & __upper_mask)
407 | (_M_x[__k + 1] & __lower_mask));
408 _M_x[__k] = (_M_x[__k + __m] ^ (__y >> 1)
409 ^ ((__y & 0x01) ? __a : 0));
412 for (
size_t __k = (__n - __m); __k < (__n - 1); ++__k)
414 _UIntType __y = ((_M_x[__k] & __upper_mask)
415 | (_M_x[__k + 1] & __lower_mask));
416 _M_x[__k] = (_M_x[__k + (__m - __n)] ^ (__y >> 1)
417 ^ ((__y & 0x01) ? __a : 0));
420 _UIntType __y = ((_M_x[__n - 1] & __upper_mask)
421 | (_M_x[0] & __lower_mask));
422 _M_x[__n - 1] = (_M_x[__m - 1] ^ (__y >> 1)
423 ^ ((__y & 0x01) ? __a : 0));
427 template<
typename _UIntType,
size_t __w,
428 size_t __n,
size_t __m,
size_t __r,
429 _UIntType __a,
size_t __u, _UIntType __d,
size_t __s,
430 _UIntType __b,
size_t __t, _UIntType __c,
size_t __l,
433 mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
435 discard(
unsigned long long __z)
437 while (
__z > state_size - _M_p)
439 __z -= state_size - _M_p;
445 template<
typename _UIntType,
size_t __w,
446 size_t __n,
size_t __m,
size_t __r,
447 _UIntType __a,
size_t __u, _UIntType __d,
size_t __s,
448 _UIntType __b,
size_t __t, _UIntType __c,
size_t __l,
452 __s, __b, __t, __c,
__l, __f>::result_type
454 __s, __b, __t, __c,
__l, __f>::
458 if (_M_p >= state_size)
462 result_type
__z = _M_x[_M_p++];
465 __z ^= (
__z << __t) & __c;
471 template<
typename _UIntType,
size_t __w,
472 size_t __n,
size_t __m,
size_t __r,
473 _UIntType __a,
size_t __u, _UIntType __d,
size_t __s,
474 _UIntType __b,
size_t __t, _UIntType __c,
size_t __l,
475 _UIntType __f,
typename _CharT,
typename _Traits>
478 const mersenne_twister_engine<_UIntType, __w, __n, __m,
479 __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>& __x)
481 using __ios_base =
typename basic_ostream<_CharT, _Traits>::ios_base;
483 const typename __ios_base::fmtflags __flags = __os.flags();
484 const _CharT __fill = __os.fill();
485 const _CharT __space = __os.widen(
' ');
486 __os.flags(__ios_base::dec | __ios_base::fixed | __ios_base::left);
489 for (
size_t __i = 0; __i < __n; ++__i)
490 __os << __x._M_x[__i] << __space;
498 template<
typename _UIntType,
size_t __w,
499 size_t __n,
size_t __m,
size_t __r,
500 _UIntType __a,
size_t __u, _UIntType __d,
size_t __s,
501 _UIntType __b,
size_t __t, _UIntType __c,
size_t __l,
502 _UIntType __f,
typename _CharT,
typename _Traits>
505 mersenne_twister_engine<_UIntType, __w, __n, __m,
506 __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>& __x)
508 using __ios_base =
typename basic_istream<_CharT, _Traits>::ios_base;
510 const typename __ios_base::fmtflags __flags = __is.flags();
511 __is.flags(__ios_base::dec | __ios_base::skipws);
513 for (
size_t __i = 0; __i < __n; ++__i)
514 __is >> __x._M_x[__i];
521#if ! __cpp_inline_variables
522 template<
typename _UIntType,
size_t __w,
size_t __s,
size_t __r>
524 subtract_with_carry_engine<_UIntType, __w, __s, __r>::word_size;
526 template<
typename _UIntType,
size_t __w,
size_t __s,
size_t __r>
528 subtract_with_carry_engine<_UIntType, __w, __s, __r>::short_lag;
530 template<
typename _UIntType,
size_t __w,
size_t __s,
size_t __r>
532 subtract_with_carry_engine<_UIntType, __w, __s, __r>::long_lag;
534 template<
typename _UIntType,
size_t __w,
size_t __s,
size_t __r>
535 constexpr uint_least32_t
536 subtract_with_carry_engine<_UIntType, __w, __s, __r>::default_seed;
539 template<
typename _UIntType,
size_t __w,
size_t __s,
size_t __r>
548 __lcg(__value == 0
u ? default_seed : __value % 2147483563u);
550 const size_t __n = (
__w + 31) / 32;
552 for (
size_t __i = 0; __i < long_lag; ++__i)
556 for (
size_t __j = 0; __j < __n; ++__j)
558 __sum += __detail::__mod<uint_least32_t,
559 __detail::_Shift<uint_least32_t, 32>::__value>
561 __factor *= __detail::_Shift<_UIntType, 32>::__value;
563 _M_x[__i] = __detail::__mod<_UIntType,
564 __detail::_Shift<_UIntType, __w>::__value>(
__sum);
566 _M_carry = (_M_x[long_lag - 1] == 0) ? 1 : 0;
570 template<
typename _UIntType,
size_t __w,
size_t __s,
size_t __r>
571 template<
typename _Sseq>
577 const size_t __k = (
__w + 31) / 32;
581 for (
size_t __i = 0; __i < long_lag; ++__i)
585 for (
size_t __j = 0; __j <
__k; ++__j)
588 __factor *= __detail::_Shift<_UIntType, 32>::__value;
590 _M_x[__i] = __detail::__mod<_UIntType,
591 __detail::_Shift<_UIntType, __w>::__value>(__sum);
593 _M_carry = (_M_x[long_lag - 1] == 0) ? 1 : 0;
597 template<
typename _UIntType,
size_t __w,
size_t __s,
size_t __r>
598 typename subtract_with_carry_engine<_UIntType, __w, __s, __r>::
604 long __ps = _M_p - short_lag;
612 if (_M_x[
__ps] >= _M_x[_M_p] + _M_carry)
614 __xi = _M_x[
__ps] - _M_x[_M_p] - _M_carry;
619 __xi = (__detail::_Shift<_UIntType, __w>::__value
620 - _M_x[_M_p] - _M_carry + _M_x[
__ps]);
626 if (++_M_p >= long_lag)
632 template<
typename _UIntType,
size_t __w,
size_t __s,
size_t __r,
633 typename _CharT,
typename _Traits>
641 const typename __ios_base::fmtflags __flags =
__os.flags();
642 const _CharT __fill =
__os.fill();
644 __os.flags(__ios_base::dec | __ios_base::fixed | __ios_base::left);
647 for (
size_t __i = 0; __i < __r; ++__i)
656 template<
typename _UIntType,
size_t __w,
size_t __s,
size_t __r,
657 typename _CharT,
typename _Traits>
660 subtract_with_carry_engine<_UIntType, __w, __s, __r>& __x)
662 using __ios_base =
typename basic_istream<_CharT, _Traits>::ios_base;
664 const typename __ios_base::fmtflags __flags = __is.flags();
665 __is.flags(__ios_base::dec | __ios_base::skipws);
667 for (
size_t __i = 0; __i < __r; ++__i)
668 __is >> __x._M_x[__i];
669 __is >> __x._M_carry;
676#if ! __cpp_inline_variables
677 template<
typename _RandomNumberEngine,
size_t __p,
size_t __r>
679 discard_block_engine<_RandomNumberEngine, __p, __r>::block_size;
681 template<
typename _RandomNumberEngine,
size_t __p,
size_t __r>
683 discard_block_engine<_RandomNumberEngine, __p, __r>::used_block;
686 template<
typename _RandomNumberEngine,
size_t __p,
size_t __r>
688 __p, __r>::result_type
692 if (_M_n >= used_block)
694 _M_b.discard(block_size - _M_n);
701 template<
typename _RandomNumberEngine,
size_t __p,
size_t __r,
702 typename _CharT,
typename _Traits>
710 const typename __ios_base::fmtflags __flags =
__os.flags();
711 const _CharT __fill =
__os.fill();
713 __os.flags(__ios_base::dec | __ios_base::fixed | __ios_base::left);
723 template<
typename _RandomNumberEngine,
size_t __p,
size_t __r,
724 typename _CharT,
typename _Traits>
727 discard_block_engine<_RandomNumberEngine, __p, __r>& __x)
729 using __ios_base =
typename basic_istream<_CharT, _Traits>::ios_base;
731 const typename __ios_base::fmtflags __flags = __is.flags();
732 __is.flags(__ios_base::dec | __ios_base::skipws);
734 __is >> __x._M_b >> __x._M_n;
741 template<
typename _RandomNumberEngine,
size_t __w,
typename _UIntType>
742 typename independent_bits_engine<_RandomNumberEngine, __w, _UIntType>::
747 typedef typename _RandomNumberEngine::result_type
_Eresult_type;
750 ? _M_b.max() - _M_b.min() + 1 : 0);
761 for (
size_t __i = 0; __i < 2; ++__i)
765 const unsigned __w0 =
__w / __n;
795 __u = _M_b() - _M_b.min();
803 __u = _M_b() - _M_b.min();
810#if ! __cpp_inline_variables
811 template<
typename _RandomNumberEngine,
size_t __k>
819 template<
typename _Tp>
821 __representable_as_double(_Tp __x)
noexcept
828 || (!(__x & 1) && __detail::__representable_as_double(__x >> 1));
832 template<
typename _Tp>
834 __p1_representable_as_double(_Tp __x)
noexcept
840 && __detail::__representable_as_double(__x + 1u));
844 template<
typename _RandomNumberEngine,
size_t __k>
863 template<
typename _RandomNumberEngine,
size_t __k,
864 typename _CharT,
typename _Traits>
871 const typename __ios_base::fmtflags __flags =
__os.flags();
872 const _CharT __fill =
__os.fill();
874 __os.flags(__ios_base::dec | __ios_base::fixed | __ios_base::left);
878 for (
size_t __i = 0; __i <
__k; ++__i)
887 template<
typename _RandomNumberEngine,
size_t __k,
888 typename _CharT,
typename _Traits>
895 const typename __ios_base::fmtflags __flags =
__is.flags();
896 __is.flags(__ios_base::dec | __ios_base::skipws);
899 for (
size_t __i = 0; __i <
__k; ++__i)
900 __is >> __x._M_v[__i];
908 template<
typename _IntType,
typename _CharT,
typename _Traits>
911 const uniform_int_distribution<_IntType>& __x)
913 using __ios_base =
typename basic_ostream<_CharT, _Traits>::ios_base;
915 const typename __ios_base::fmtflags __flags = __os.flags();
916 const _CharT __fill = __os.fill();
917 const _CharT __space = __os.widen(
' ');
918 __os.flags(__ios_base::scientific | __ios_base::left);
921 __os << __x.a() << __space << __x.b();
928 template<
typename _IntType,
typename _CharT,
typename _Traits>
937 const typename __ios_base::fmtflags __flags =
__is.flags();
938 __is.flags(__ios_base::dec | __ios_base::skipws);
941 if (
__is >> __a >> __b)
942 __x.param(param_type(__a, __b));
949 template<
typename _RealType>
950 template<
typename _ForwardIterator,
951 typename _UniformRandomNumberGenerator>
956 const param_type& __p)
959 __detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
961 auto __range = __p.b() - __p.a();
966 template<
typename _RealType,
typename _CharT,
typename _Traits>
969 const uniform_real_distribution<_RealType>& __x)
971 using __ios_base =
typename basic_ostream<_CharT, _Traits>::ios_base;
973 const typename __ios_base::fmtflags __flags = __os.flags();
974 const _CharT __fill = __os.fill();
976 const _CharT __space = __os.widen(
' ');
977 __os.flags(__ios_base::scientific | __ios_base::left);
981 __os << __x.a() << __space << __x.b();
985 __os.precision(__precision);
989 template<
typename _RealType,
typename _CharT,
typename _Traits>
998 const typename __ios_base::fmtflags __flags =
__is.flags();
999 __is.flags(__ios_base::skipws);
1002 if (
__is >> __a >> __b)
1003 __x.param(param_type(__a, __b));
1005 __is.flags(__flags);
1010 template<
typename _ForwardIterator,
1011 typename _UniformRandomNumberGenerator>
1013 std::bernoulli_distribution::
1016 const param_type& __p)
1019 __detail::_Adaptor<_UniformRandomNumberGenerator, double>
1027 template<
typename _CharT,
typename _Traits>
1030 const bernoulli_distribution& __x)
1032 using __ios_base =
typename basic_ostream<_CharT, _Traits>::ios_base;
1034 const typename __ios_base::fmtflags __flags = __os.flags();
1035 const _CharT __fill = __os.fill();
1037 __os.flags(__ios_base::scientific | __ios_base::left);
1038 __os.fill(__os.widen(
' '));
1043 __os.flags(__flags);
1045 __os.precision(__precision);
1050 template<
typename _IntType>
1051 template<
typename _UniformRandomNumberGenerator>
1054 operator()(_UniformRandomNumberGenerator& __urng,
1055 const param_type& __param)
1059 const double __naf =
1062 const double __thr =
1064 __detail::_Adaptor<_UniformRandomNumberGenerator, double>
1069 __cand = std::floor(
std::log(1.0 - __aurng()) / __param._M_log_1_p);
1070 while (__cand >= __thr);
1072 return result_type(__cand + __naf);
1075 template<
typename _IntType>
1076 template<
typename _ForwardIterator,
1077 typename _UniformRandomNumberGenerator>
1087 const double __naf =
1090 const double __thr =
1092 __detail::_Adaptor<_UniformRandomNumberGenerator, double>
1107 template<
typename _IntType,
1108 typename _CharT,
typename _Traits>
1111 const geometric_distribution<_IntType>& __x)
1113 using __ios_base =
typename basic_ostream<_CharT, _Traits>::ios_base;
1115 const typename __ios_base::fmtflags __flags = __os.flags();
1116 const _CharT __fill = __os.fill();
1118 __os.flags(__ios_base::scientific | __ios_base::left);
1119 __os.fill(__os.widen(
' '));
1124 __os.flags(__flags);
1126 __os.precision(__precision);
1130 template<
typename _IntType,
1131 typename _CharT,
typename _Traits>
1139 const typename __ios_base::fmtflags __flags =
__is.flags();
1140 __is.flags(__ios_base::skipws);
1144 __x.param(param_type(__p));
1146 __is.flags(__flags);
1151 template<
typename _IntType>
1152 template<
typename _UniformRandomNumberGenerator>
1157 const double __y = _M_gd(
__urng);
1164 template<
typename _IntType>
1165 template<
typename _UniformRandomNumberGenerator>
1169 const param_type& __p)
1175 _M_gd(
__urng, param_type(__p.k(), (1.0 - __p.p()) / __p.p()));
1181 template<
typename _IntType>
1182 template<
typename _ForwardIterator,
1183 typename _UniformRandomNumberGenerator>
1185 negative_binomial_distribution<_IntType>::
1186 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
1187 _UniformRandomNumberGenerator& __urng)
1189 __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
1192 const double __y = _M_gd(__urng);
1196 *__f++ = __poisson(__urng);
1200 template<
typename _IntType>
1201 template<
typename _ForwardIterator,
1202 typename _UniformRandomNumberGenerator>
1204 negative_binomial_distribution<_IntType>::
1205 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
1206 _UniformRandomNumberGenerator& __urng,
1207 const param_type& __p)
1209 __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
1211 __p2(__p.k(), (1.0 - __p.p()) / __p.p());
1215 const double __y = _M_gd(__urng, __p2);
1218 *__f++ = __poisson(__urng);
1222 template<
typename _IntType,
typename _CharT,
typename _Traits>
1225 const negative_binomial_distribution<_IntType>& __x)
1227 using __ios_base =
typename basic_ostream<_CharT, _Traits>::ios_base;
1229 const typename __ios_base::fmtflags __flags = __os.flags();
1230 const _CharT __fill = __os.fill();
1232 const _CharT __space = __os.widen(
' ');
1233 __os.flags(__ios_base::scientific | __ios_base::left);
1234 __os.fill(__os.widen(
' '));
1237 __os << __x.k() << __space << __x.p()
1238 << __space << __x._M_gd;
1240 __os.flags(__flags);
1242 __os.precision(__precision);
1246 template<
typename _IntType,
typename _CharT,
typename _Traits>
1249 negative_binomial_distribution<_IntType>& __x)
1252 =
typename negative_binomial_distribution<_IntType>::param_type;
1253 using __ios_base =
typename basic_istream<_CharT, _Traits>::ios_base;
1255 const typename __ios_base::fmtflags __flags = __is.flags();
1256 __is.flags(__ios_base::skipws);
1260 if (__is >> __k >> __p >> __x._M_gd)
1261 __x.param(param_type(__k, __p));
1263 __is.flags(__flags);
1268 template<
typename _IntType>
1270 poisson_distribution<_IntType>::param_type::
1273#if _GLIBCXX_USE_C99_MATH_FUNCS
1276 const double __m = std::floor(_M_mean);
1278 _M_lfm = std::lgamma(__m + 1);
1281 const double __pi_4 = 0.7853981633974483096156608458198757L;
1285 const double __cx = 2 * __m + _M_d;
1290 _M_cb = 2 * __cx *
std::exp(-_M_d * _M_1cx * (1 + _M_d / 2))
1308 template<
typename _IntType>
1309 template<
typename _UniformRandomNumberGenerator>
1315 __detail::_Adaptor<_UniformRandomNumberGenerator, double>
1317#if _GLIBCXX_USE_C99_MATH_FUNCS
1323 const double __naf =
1325 const double __thr =
1328 const double __m = std::floor(
__param.mean());
1330 const double __spi_2 = 1.2533141373155002512078826424055226L;
1333 const double __c3 = __c2 + 1;
1336 const double __178 = 0.0128205128205128205128205128205128L;
1338 const double __e178 = 1.0129030479320018583185514777512983L;
1353 const double __n = _M_nd(
__urng);
1355 __x = std::floor(__y);
1356 __w = -__n * __n / 2;
1360 else if (
__u <= __c2)
1362 const double __n = _M_nd(
__urng);
1364 __x = std::ceil(__y);
1384 const double __y =
__param._M_d
1386 __x = std::ceil(__y);
1391 >
__param._M_lfm - std::lgamma(__x +
__m + 1));
1416 template<
typename _IntType>
1431 template<
typename _IntType,
1432 typename _CharT,
typename _Traits>
1435 const poisson_distribution<_IntType>& __x)
1437 using __ios_base =
typename basic_ostream<_CharT, _Traits>::ios_base;
1439 const typename __ios_base::fmtflags __flags = __os.flags();
1440 const _CharT __fill = __os.fill();
1442 const _CharT __space = __os.widen(
' ');
1443 __os.flags(__ios_base::scientific | __ios_base::left);
1447 __os << __x.mean() << __space << __x._M_nd;
1449 __os.flags(__flags);
1451 __os.precision(__precision);
1455 template<
typename _IntType,
1456 typename _CharT,
typename _Traits>
1459 poisson_distribution<_IntType>& __x)
1461 using param_type =
typename poisson_distribution<_IntType>::param_type;
1462 using __ios_base =
typename basic_istream<_CharT, _Traits>::ios_base;
1464 const typename __ios_base::fmtflags __flags = __is.flags();
1465 __is.flags(__ios_base::skipws);
1468 if (__is >> __mean >> __x._M_nd)
1469 __x.param(param_type(__mean));
1471 __is.flags(__flags);
1476 template<
typename _IntType>
1478 binomial_distribution<_IntType>::param_type::
1481 const double __p12 = _M_p <= 0.5 ? _M_p : 1.0 - _M_p;
1485#if _GLIBCXX_USE_C99_MATH_FUNCS
1486 if (_M_t * __p12 >= 8)
1489 const double __np = std::floor(_M_t * __p12);
1490 const double __pa = __np / _M_t;
1491 const double __1p = 1 - __pa;
1493 const double __pi_4 = 0.7853981633974483096156608458198757L;
1494 const double __d1x =
1496 / (81 * __pi_4 * __1p)));
1498 const double __d2x =
1500 / (__pi_4 * __pa)));
1504 const double __spi_2 = 1.2533141373155002512078826424055226L;
1505 _M_s1 =
std::sqrt(__np * __1p) * (1 + _M_d1 / (4 * __np));
1506 _M_s2 =
std::sqrt(__np * __1p) * (1 + _M_d2 / (4 * (_M_t * __1p)));
1507 _M_c = 2 * _M_d1 / __np;
1508 _M_a1 =
std::exp(_M_c) * _M_s1 * __spi_2;
1509 const double __a12 = _M_a1 + _M_s2 * __spi_2;
1510 const double __s1s = _M_s1 * _M_s1;
1511 _M_a123 = __a12 + (
std::exp(_M_d1 / (_M_t * __1p))
1513 *
std::exp(-_M_d1 * _M_d1 / (2 * __s1s)));
1514 const double __s2s = _M_s2 * _M_s2;
1515 _M_s = (_M_a123 + 2 * __s2s / _M_d2
1516 *
std::exp(-_M_d2 * _M_d2 / (2 * __s2s)));
1517 _M_lf = (std::lgamma(__np + 1)
1518 + std::lgamma(_M_t - __np + 1));
1521 _M_q = -
std::log(1 - (__p12 - __pa) / __1p);
1528 template<
typename _IntType>
1529 template<
typename _UniformRandomNumberGenerator>
1531 binomial_distribution<_IntType>::
1532 _M_waiting(_UniformRandomNumberGenerator& __urng,
1533 _IntType __t,
double __q)
1537 __detail::_Adaptor<_UniformRandomNumberGenerator, double>
1544 const double __e = -
std::log(1.0 - __aurng());
1545 __sum += __e / (__t - __x);
1548 while (__sum <= __q);
1563 template<
typename _IntType>
1564 template<
typename _UniformRandomNumberGenerator>
1571 const _IntType __t =
__param.t();
1572 const double __p =
__param.p();
1573 const double __p12 = __p <= 0.5 ? __p : 1.0 - __p;
1574 __detail::_Adaptor<_UniformRandomNumberGenerator, double>
1577#if _GLIBCXX_USE_C99_MATH_FUNCS
1583 const double __naf =
1585 const double __thr =
1588 const double __np = std::floor(__t *
__p12);
1591 const double __spi_2 = 1.2533141373155002512078826424055226L;
1607 const double __n = _M_nd(
__urng);
1613 __x = std::floor(__y);
1619 const double __n = _M_nd(
__urng);
1625 __x = std::floor(-__y);
1626 __v = -__e - __n * __n / 2;
1634 const double __y =
__param._M_d1
1636 __x = std::floor(__y);
1638 -__y / (2 *
__s1s)));
1646 const double __y =
__param._M_d2
1648 __x = std::floor(-__y);
1656 const double __lfx =
1657 std::lgamma(
__np + __x + 1)
1658 + std::lgamma(__t - (
__np + __x) + 1);
1669 const _IntType
__z = _M_waiting(
__urng, __t - _IntType(__x),
1682 template<
typename _IntType>
1697 template<
typename _IntType,
1698 typename _CharT,
typename _Traits>
1701 const binomial_distribution<_IntType>& __x)
1703 using __ios_base =
typename basic_ostream<_CharT, _Traits>::ios_base;
1705 const typename __ios_base::fmtflags __flags = __os.flags();
1706 const _CharT __fill = __os.fill();
1708 const _CharT __space = __os.widen(
' ');
1709 __os.flags(__ios_base::scientific | __ios_base::left);
1713 __os << __x.t() << __space << __x.p()
1714 << __space << __x._M_nd;
1716 __os.flags(__flags);
1718 __os.precision(__precision);
1722 template<
typename _IntType,
1723 typename _CharT,
typename _Traits>
1726 binomial_distribution<_IntType>& __x)
1728 using param_type =
typename binomial_distribution<_IntType>::param_type;
1729 using __ios_base =
typename basic_istream<_CharT, _Traits>::ios_base;
1731 const typename __ios_base::fmtflags __flags = __is.flags();
1732 __is.flags(__ios_base::dec | __ios_base::skipws);
1736 if (__is >> __t >> __p >> __x._M_nd)
1737 __x.param(param_type(__t, __p));
1739 __is.flags(__flags);
1744 template<
typename _RealType>
1745 template<
typename _ForwardIterator,
1746 typename _UniformRandomNumberGenerator>
1751 const param_type& __p)
1754 __detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
1760 template<
typename _RealType,
typename _CharT,
typename _Traits>
1763 const exponential_distribution<_RealType>& __x)
1765 using __ios_base =
typename basic_ostream<_CharT, _Traits>::ios_base;
1767 const typename __ios_base::fmtflags __flags = __os.flags();
1768 const _CharT __fill = __os.fill();
1770 __os.flags(__ios_base::scientific | __ios_base::left);
1771 __os.fill(__os.widen(
' '));
1774 __os << __x.lambda();
1776 __os.flags(__flags);
1778 __os.precision(__precision);
1782 template<
typename _RealType,
typename _CharT,
typename _Traits>
1791 const typename __ios_base::fmtflags __flags =
__is.flags();
1792 __is.flags(__ios_base::dec | __ios_base::skipws);
1798 __is.flags(__flags);
1809 template<
typename _RealType>
1810 template<
typename _UniformRandomNumberGenerator>
1817 __detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
1820 if (_M_saved_available)
1822 _M_saved_available =
false;
1832 __r2 = __x * __x + __y * __y;
1838 _M_saved_available =
true;
1846 template<
typename _RealType>
1860 if (_M_saved_available)
1862 _M_saved_available =
false;
1869 __detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
1872 while (__f + 1 < __t)
1879 __r2 = __x * __x + __y * __y;
1881 while (__r2 > 1.0 || __r2 == 0.0);
1884 *__f++ = __y * __mult * __param.stddev() + __param.mean();
1885 *__f++ = __x * __mult * __param.stddev() + __param.mean();
1895 __r2 = __x * __x + __y * __y;
1897 while (__r2 > 1.0 || __r2 == 0.0);
1900 _M_saved = __x * __mult;
1901 _M_saved_available =
true;
1902 *__f = __y * __mult * __param.stddev() + __param.mean();
1906 template<
typename _RealType>
1911 if (__d1._M_param == __d2._M_param
1912 && __d1._M_saved_available == __d2._M_saved_available)
1913 return __d1._M_saved_available ? __d1._M_saved == __d2._M_saved :
true;
1918 template<
typename _RealType,
typename _CharT,
typename _Traits>
1921 const normal_distribution<_RealType>& __x)
1923 using __ios_base =
typename basic_ostream<_CharT, _Traits>::ios_base;
1925 const typename __ios_base::fmtflags __flags = __os.flags();
1926 const _CharT __fill = __os.fill();
1928 const _CharT __space = __os.widen(
' ');
1929 __os.flags(__ios_base::scientific | __ios_base::left);
1933 __os << __x.mean() << __space << __x.stddev()
1934 << __space << __x._M_saved_available;
1935 if (__x._M_saved_available)
1936 __os << __space << __x._M_saved;
1938 __os.flags(__flags);
1940 __os.precision(__precision);
1944 template<
typename _RealType,
typename _CharT,
typename _Traits>
1947 normal_distribution<_RealType>& __x)
1949 using param_type =
typename normal_distribution<_RealType>::param_type;
1950 using __ios_base =
typename basic_istream<_CharT, _Traits>::ios_base;
1952 const typename __ios_base::fmtflags __flags = __is.flags();
1953 __is.flags(__ios_base::dec | __ios_base::skipws);
1955 double __mean, __stddev;
1957 if (__is >> __mean >> __stddev >> __saved_avail)
1959 if (!__saved_avail || (__is >> __x._M_saved))
1961 __x._M_saved_available = __saved_avail;
1962 __x.param(param_type(__mean, __stddev));
1966 __is.flags(__flags);
1971 template<
typename _RealType>
1972 template<
typename _ForwardIterator,
1973 typename _UniformRandomNumberGenerator>
1975 lognormal_distribution<_RealType>::
1976 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
1977 _UniformRandomNumberGenerator& __urng,
1978 const param_type& __p)
1980 __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
1982 *__f++ =
std::exp(__p.s() * _M_nd(__urng) + __p.m());
1985 template<
typename _RealType,
typename _CharT,
typename _Traits>
1988 const lognormal_distribution<_RealType>& __x)
1990 using __ios_base =
typename basic_ostream<_CharT, _Traits>::ios_base;
1992 const typename __ios_base::fmtflags __flags = __os.flags();
1993 const _CharT __fill = __os.fill();
1995 const _CharT __space = __os.widen(
' ');
1996 __os.flags(__ios_base::scientific | __ios_base::left);
2000 __os << __x.m() << __space << __x.s()
2001 << __space << __x._M_nd;
2003 __os.flags(__flags);
2005 __os.precision(__precision);
2009 template<
typename _RealType,
typename _CharT,
typename _Traits>
2012 lognormal_distribution<_RealType>& __x)
2015 =
typename lognormal_distribution<_RealType>::param_type;
2016 using __ios_base =
typename basic_istream<_CharT, _Traits>::ios_base;
2018 const typename __ios_base::fmtflags __flags = __is.flags();
2019 __is.flags(__ios_base::dec | __ios_base::skipws);
2022 if (__is >> __m >> __s >> __x._M_nd)
2023 __x.param(param_type(__m, __s));
2025 __is.flags(__flags);
2029 template<
typename _RealType>
2030 template<
typename _ForwardIterator,
2031 typename _UniformRandomNumberGenerator>
2035 _UniformRandomNumberGenerator& __urng)
2037 __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
2039 *__f++ = 2 * _M_gd(__urng);
2042 template<
typename _RealType>
2043 template<
typename _ForwardIterator,
2044 typename _UniformRandomNumberGenerator>
2048 _UniformRandomNumberGenerator& __urng,
2052 __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
2054 *__f++ = 2 * _M_gd(__urng, __p);
2057 template<
typename _RealType,
typename _CharT,
typename _Traits>
2060 const chi_squared_distribution<_RealType>& __x)
2062 using __ios_base =
typename basic_ostream<_CharT, _Traits>::ios_base;
2064 const typename __ios_base::fmtflags __flags = __os.flags();
2065 const _CharT __fill = __os.fill();
2067 const _CharT __space = __os.widen(
' ');
2068 __os.flags(__ios_base::scientific | __ios_base::left);
2072 __os << __x.n() << __space << __x._M_gd;
2074 __os.flags(__flags);
2076 __os.precision(__precision);
2080 template<
typename _RealType,
typename _CharT,
typename _Traits>
2083 chi_squared_distribution<_RealType>& __x)
2086 =
typename chi_squared_distribution<_RealType>::param_type;
2087 using __ios_base =
typename basic_istream<_CharT, _Traits>::ios_base;
2089 const typename __ios_base::fmtflags __flags = __is.flags();
2090 __is.flags(__ios_base::dec | __ios_base::skipws);
2093 if (__is >> __n >> __x._M_gd)
2094 __x.param(param_type(__n));
2096 __is.flags(__flags);
2101 template<
typename _RealType>
2102 template<
typename _UniformRandomNumberGenerator>
2105 operator()(_UniformRandomNumberGenerator& __urng,
2106 const param_type& __p)
2108 __detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
2115 const _RealType __pi = 3.1415926535897932384626433832795029L;
2116 return __p.a() + __p.b() *
std::tan(__pi * __u);
2119 template<
typename _RealType>
2120 template<
typename _ForwardIterator,
2121 typename _UniformRandomNumberGenerator>
2126 const param_type& __p)
2129 const _RealType __pi = 3.1415926535897932384626433832795029L;
2130 __detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
2139 *__f++ = __p.a() + __p.b() *
std::tan(__pi *
__u);
2143 template<
typename _RealType,
typename _CharT,
typename _Traits>
2146 const cauchy_distribution<_RealType>& __x)
2148 using __ios_base =
typename basic_ostream<_CharT, _Traits>::ios_base;
2150 const typename __ios_base::fmtflags __flags = __os.flags();
2151 const _CharT __fill = __os.fill();
2153 const _CharT __space = __os.widen(
' ');
2154 __os.flags(__ios_base::scientific | __ios_base::left);
2158 __os << __x.a() << __space << __x.b();
2160 __os.flags(__flags);
2162 __os.precision(__precision);
2166 template<
typename _RealType,
typename _CharT,
typename _Traits>
2174 const typename __ios_base::fmtflags __flags =
__is.flags();
2175 __is.flags(__ios_base::dec | __ios_base::skipws);
2178 if (
__is >> __a >> __b)
2179 __x.param(param_type(__a, __b));
2181 __is.flags(__flags);
2186 template<
typename _RealType>
2187 template<
typename _ForwardIterator,
2188 typename _UniformRandomNumberGenerator>
2192 _UniformRandomNumberGenerator& __urng)
2194 __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
2196 *__f++ = ((_M_gd_x(__urng) * n()) / (_M_gd_y(__urng) * m()));
2199 template<
typename _RealType>
2200 template<
typename _ForwardIterator,
2201 typename _UniformRandomNumberGenerator>
2205 _UniformRandomNumberGenerator& __urng,
2206 const param_type& __p)
2208 __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
2211 param_type __p1(__p.m() / 2);
2212 param_type __p2(__p.n() / 2);
2214 *__f++ = ((_M_gd_x(__urng, __p1) * n())
2215 / (_M_gd_y(__urng, __p2) * m()));
2218 template<
typename _RealType,
typename _CharT,
typename _Traits>
2221 const fisher_f_distribution<_RealType>& __x)
2223 using __ios_base =
typename basic_ostream<_CharT, _Traits>::ios_base;
2225 const typename __ios_base::fmtflags __flags = __os.flags();
2226 const _CharT __fill = __os.fill();
2228 const _CharT __space = __os.widen(
' ');
2229 __os.flags(__ios_base::scientific | __ios_base::left);
2233 __os << __x.m() << __space << __x.n()
2234 << __space << __x._M_gd_x << __space << __x._M_gd_y;
2236 __os.flags(__flags);
2238 __os.precision(__precision);
2242 template<
typename _RealType,
typename _CharT,
typename _Traits>
2251 const typename __ios_base::fmtflags __flags =
__is.flags();
2252 __is.flags(__ios_base::dec | __ios_base::skipws);
2255 if (
__is >>
__m >> __n >> __x._M_gd_x >> __x._M_gd_y)
2256 __x.param(param_type(
__m, __n));
2258 __is.flags(__flags);
2263 template<
typename _RealType>
2276 template<
typename _RealType>
2277 template<
typename _ForwardIterator,
2278 typename _UniformRandomNumberGenerator>
2282 _UniformRandomNumberGenerator& __urng,
2283 const param_type& __p)
2285 __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
2287 __p2(__p.n() / 2, 2);
2289 *__f++ = _M_nd(__urng) *
std::sqrt(__p.n() / _M_gd(__urng, __p2));
2292 template<
typename _RealType,
typename _CharT,
typename _Traits>
2295 const student_t_distribution<_RealType>& __x)
2297 using __ios_base =
typename basic_ostream<_CharT, _Traits>::ios_base;
2299 const typename __ios_base::fmtflags __flags = __os.flags();
2300 const _CharT __fill = __os.fill();
2302 const _CharT __space = __os.widen(
' ');
2303 __os.flags(__ios_base::scientific | __ios_base::left);
2307 __os << __x.n() << __space << __x._M_nd << __space << __x._M_gd;
2309 __os.flags(__flags);
2311 __os.precision(__precision);
2315 template<
typename _RealType,
typename _CharT,
typename _Traits>
2318 student_t_distribution<_RealType>& __x)
2321 =
typename student_t_distribution<_RealType>::param_type;
2322 using __ios_base =
typename basic_istream<_CharT, _Traits>::ios_base;
2324 const typename __ios_base::fmtflags __flags = __is.flags();
2325 __is.flags(__ios_base::dec | __ios_base::skipws);
2328 if (__is >> __n >> __x._M_nd >> __x._M_gd)
2329 __x.param(param_type(__n));
2331 __is.flags(__flags);
2336 template<
typename _RealType>
2338 gamma_distribution<_RealType>::param_type::
2341 _M_malpha = _M_alpha < 1.0 ? _M_alpha + _RealType(1.0) : _M_alpha;
2343 const _RealType __a1 = _M_malpha - _RealType(1.0) / _RealType(3.0);
2344 _M_a2 = _RealType(1.0) /
std::sqrt(_RealType(9.0) * __a1);
2352 template<
typename _RealType>
2353 template<
typename _UniformRandomNumberGenerator>
2359 __detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
2364 - _RealType(1.0) / _RealType(3.0));
2395 template<
typename _RealType>
2405 __detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
2410 - _RealType(1.0) / _RealType(3.0));
2424 __v = __v * __v * __v;
2427 while (__u >
result_type(1.0) - 0.0331 * __n * __n * __n * __n
2428 && (
std::log(__u) > (0.5 * __n * __n + __a1
2431 *__f++ = __a1 * __v * __param.beta();
2440 __n = _M_nd(__urng);
2445 __v = __v * __v * __v;
2448 while (__u >
result_type(1.0) - 0.0331 * __n * __n * __n * __n
2449 && (
std::log(__u) > (0.5 * __n * __n + __a1
2457 * __a1 * __v * __param.beta());
2461 template<
typename _RealType,
typename _CharT,
typename _Traits>
2464 const gamma_distribution<_RealType>& __x)
2466 using __ios_base =
typename basic_ostream<_CharT, _Traits>::ios_base;
2468 const typename __ios_base::fmtflags __flags = __os.flags();
2469 const _CharT __fill = __os.fill();
2471 const _CharT __space = __os.widen(
' ');
2472 __os.flags(__ios_base::scientific | __ios_base::left);
2476 __os << __x.alpha() << __space << __x.beta()
2477 << __space << __x._M_nd;
2479 __os.flags(__flags);
2481 __os.precision(__precision);
2485 template<
typename _RealType,
typename _CharT,
typename _Traits>
2488 gamma_distribution<_RealType>& __x)
2490 using param_type =
typename gamma_distribution<_RealType>::param_type;
2491 using __ios_base =
typename basic_istream<_CharT, _Traits>::ios_base;
2493 const typename __ios_base::fmtflags __flags = __is.flags();
2494 __is.flags(__ios_base::dec | __ios_base::skipws);
2496 _RealType __alpha_val, __beta_val;
2497 if (__is >> __alpha_val >> __beta_val >> __x._M_nd)
2498 __x.param(param_type(__alpha_val, __beta_val));
2500 __is.flags(__flags);
2505 template<
typename _RealType>
2506 template<
typename _UniformRandomNumberGenerator>
2509 operator()(_UniformRandomNumberGenerator& __urng,
2510 const param_type& __p)
2512 __detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
2518 template<
typename _RealType>
2519 template<
typename _ForwardIterator,
2520 typename _UniformRandomNumberGenerator>
2525 const param_type& __p)
2528 __detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
2537 template<
typename _RealType,
typename _CharT,
typename _Traits>
2540 const weibull_distribution<_RealType>& __x)
2542 using __ios_base =
typename basic_ostream<_CharT, _Traits>::ios_base;
2544 const typename __ios_base::fmtflags __flags = __os.flags();
2545 const _CharT __fill = __os.fill();
2547 const _CharT __space = __os.widen(
' ');
2548 __os.flags(__ios_base::scientific | __ios_base::left);
2552 __os << __x.a() << __space << __x.b();
2554 __os.flags(__flags);
2556 __os.precision(__precision);
2560 template<
typename _RealType,
typename _CharT,
typename _Traits>
2568 const typename __ios_base::fmtflags __flags =
__is.flags();
2569 __is.flags(__ios_base::dec | __ios_base::skipws);
2572 if (
__is >> __a >> __b)
2573 __x.param(param_type(__a, __b));
2575 __is.flags(__flags);
2580 template<
typename _RealType>
2581 template<
typename _UniformRandomNumberGenerator>
2584 operator()(_UniformRandomNumberGenerator& __urng,
2585 const param_type& __p)
2587 __detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
2593 template<
typename _RealType>
2594 template<
typename _ForwardIterator,
2595 typename _UniformRandomNumberGenerator>
2600 const param_type& __p)
2603 __detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
2611 template<
typename _RealType,
typename _CharT,
typename _Traits>
2614 const extreme_value_distribution<_RealType>& __x)
2616 using __ios_base =
typename basic_ostream<_CharT, _Traits>::ios_base;
2618 const typename __ios_base::fmtflags __flags = __os.flags();
2619 const _CharT __fill = __os.fill();
2621 const _CharT __space = __os.widen(
' ');
2622 __os.flags(__ios_base::scientific | __ios_base::left);
2626 __os << __x.a() << __space << __x.b();
2628 __os.flags(__flags);
2630 __os.precision(__precision);
2634 template<
typename _RealType,
typename _CharT,
typename _Traits>
2643 const typename __ios_base::fmtflags __flags =
__is.flags();
2644 __is.flags(__ios_base::dec | __ios_base::skipws);
2647 if (
__is >> __a >> __b)
2648 __x.param(param_type(__a, __b));
2650 __is.flags(__flags);
2655 template<
typename _IntType>
2657 discrete_distribution<_IntType>::param_type::
2660 if (_M_prob.size() < 2)
2667 _M_prob.end(), 0.0);
2668 __glibcxx_assert(__sum > 0);
2670 __detail::__normalize(_M_prob.begin(), _M_prob.end(), _M_prob.begin(),
2673 _M_cp.reserve(_M_prob.size());
2677 _M_cp[_M_cp.size() - 1] = 1.0;
2680 template<
typename _IntType>
2681 template<
typename _Func>
2682 discrete_distribution<_IntType>::param_type::
2683 param_type(
size_t __nw,
double __xmin,
double __xmax, _Func __fw)
2684 : _M_prob(), _M_cp()
2686 const size_t __n = __nw == 0 ? 1 : __nw;
2687 const double __delta = (__xmax - __xmin) / __n;
2689 _M_prob.reserve(__n);
2690 for (
size_t __k = 0; __k < __nw; ++__k)
2691 _M_prob.push_back(__fw(__xmin + __k * __delta + 0.5 * __delta));
2696 template<
typename _IntType>
2697 template<
typename _UniformRandomNumberGenerator>
2698 typename discrete_distribution<_IntType>::result_type
2699 discrete_distribution<_IntType>::
2700 operator()(_UniformRandomNumberGenerator& __urng,
2701 const param_type& __param)
2703 if (__param._M_cp.empty())
2704 return result_type(0);
2706 __detail::_Adaptor<_UniformRandomNumberGenerator, double>
2716 template<
typename _IntType>
2730 *__f++ = result_type(0);
2734 __detail::_Adaptor<_UniformRandomNumberGenerator, double>
2739 const double __p = __aurng();
2740 auto __pos = std::lower_bound(__param._M_cp.begin(),
2741 __param._M_cp.end(), __p);
2743 *__f++ = __pos - __param._M_cp.begin();
2747 template<
typename _IntType,
typename _CharT,
typename _Traits>
2750 const discrete_distribution<_IntType>& __x)
2752 using __ios_base =
typename basic_ostream<_CharT, _Traits>::ios_base;
2754 const typename __ios_base::fmtflags __flags = __os.flags();
2755 const _CharT __fill = __os.fill();
2757 const _CharT __space = __os.widen(
' ');
2758 __os.flags(__ios_base::scientific | __ios_base::left);
2763 __os << __prob.size();
2764 for (
auto __dit = __prob.begin(); __dit != __prob.end(); ++__dit)
2765 __os << __space << *__dit;
2767 __os.flags(__flags);
2769 __os.precision(__precision);
2775 template<
typename _ValT,
typename _CharT,
typename _Traits>
2776 basic_istream<_CharT, _Traits>&
2777 __extract_params(basic_istream<_CharT, _Traits>& __is,
2778 vector<_ValT>& __vals,
size_t __n)
2780 __vals.reserve(__n);
2785 __vals.push_back(__val);
2793 template<
typename _IntType,
typename _CharT,
typename _Traits>
2796 discrete_distribution<_IntType>& __x)
2798 using __ios_base =
typename basic_istream<_CharT, _Traits>::ios_base;
2800 const typename __ios_base::fmtflags __flags = __is.flags();
2801 __is.flags(__ios_base::dec | __ios_base::skipws);
2807 if (__detail::__extract_params(__is, __prob_vec, __n))
2808 __x.param({__prob_vec.begin(), __prob_vec.end()});
2811 __is.flags(__flags);
2816 template<
typename _RealType>
2818 piecewise_constant_distribution<_RealType>::param_type::
2821 if (_M_int.size() < 2
2822 || (_M_int.size() == 2
2823 && _M_int[0] == _RealType(0)
2824 && _M_int[1] == _RealType(1)))
2833 __glibcxx_assert(__sum > 0);
2835 __detail::__normalize(_M_den.begin(), _M_den.end(), _M_den.begin(),
2838 _M_cp.reserve(_M_den.size());
2843 _M_cp[_M_cp.size() - 1] = 1.0;
2845 for (
size_t __k = 0; __k < _M_den.size(); ++__k)
2846 _M_den[__k] /= _M_int[__k + 1] - _M_int[__k];
2849 template<
typename _RealType>
2850 template<
typename _InputIteratorB,
typename _InputIteratorW>
2851 piecewise_constant_distribution<_RealType>::param_type::
2852 param_type(_InputIteratorB __bbegin,
2853 _InputIteratorB __bend,
2854 _InputIteratorW __wbegin)
2855 : _M_int(), _M_den(), _M_cp()
2857 if (__bbegin != __bend)
2861 _M_int.push_back(*__bbegin);
2863 if (__bbegin == __bend)
2866 _M_den.push_back(*__wbegin);
2874 template<
typename _RealType>
2875 template<
typename _Func>
2876 piecewise_constant_distribution<_RealType>::param_type::
2877 param_type(initializer_list<_RealType> __bl, _Func __fw)
2878 : _M_int(), _M_den(), _M_cp()
2880 _M_int.reserve(__bl.size());
2881 for (
auto __biter = __bl.begin(); __biter != __bl.end(); ++__biter)
2882 _M_int.push_back(*__biter);
2884 _M_den.reserve(_M_int.size() - 1);
2885 for (
size_t __k = 0; __k < _M_int.size() - 1; ++__k)
2886 _M_den.push_back(__fw(0.5 * (_M_int[__k + 1] + _M_int[__k])));
2891 template<
typename _RealType>
2892 template<
typename _Func>
2893 piecewise_constant_distribution<_RealType>::param_type::
2894 param_type(
size_t __nw, _RealType __xmin, _RealType __xmax, _Func __fw)
2895 : _M_int(), _M_den(), _M_cp()
2897 const size_t __n = __nw == 0 ? 1 : __nw;
2898 const _RealType __delta = (__xmax - __xmin) / __n;
2900 _M_int.reserve(__n + 1);
2901 for (
size_t __k = 0; __k <= __nw; ++__k)
2902 _M_int.push_back(__xmin + __k * __delta);
2904 _M_den.reserve(__n);
2905 for (
size_t __k = 0; __k < __nw; ++__k)
2906 _M_den.push_back(__fw(_M_int[__k] + 0.5 * __delta));
2911 template<
typename _RealType>
2912 template<
typename _UniformRandomNumberGenerator>
2913 typename piecewise_constant_distribution<_RealType>::result_type
2914 piecewise_constant_distribution<_RealType>::
2915 operator()(_UniformRandomNumberGenerator& __urng,
2916 const param_type& __param)
2918 __detail::_Adaptor<_UniformRandomNumberGenerator, double>
2921 const double __p = __aurng();
2922 if (__param._M_cp.empty())
2925 auto __pos = std::lower_bound(__param._M_cp.begin(),
2926 __param._M_cp.end(), __p);
2927 const size_t __i = __pos - __param._M_cp.begin();
2929 const double __pref = __i > 0 ? __param._M_cp[__i - 1] : 0.0;
2931 return __param._M_int[__i] + (__p - __pref) / __param._M_den[__i];
2934 template<
typename _RealType>
2935 template<
typename _ForwardIterator,
2936 typename _UniformRandomNumberGenerator>
2938 piecewise_constant_distribution<_RealType>::
2939 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
2940 _UniformRandomNumberGenerator& __urng,
2941 const param_type& __param)
2943 __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
2944 __detail::_Adaptor<_UniformRandomNumberGenerator, double>
2947 if (__param._M_cp.empty())
2956 const double __p = __aurng();
2958 auto __pos = std::lower_bound(__param._M_cp.begin(),
2959 __param._M_cp.end(), __p);
2960 const size_t __i = __pos - __param._M_cp.begin();
2962 const double __pref = __i > 0 ? __param._M_cp[__i - 1] : 0.0;
2964 *__f++ = (__param._M_int[__i]
2965 + (__p - __pref) / __param._M_den[__i]);
2969 template<
typename _RealType,
typename _CharT,
typename _Traits>
2972 const piecewise_constant_distribution<_RealType>& __x)
2974 using __ios_base =
typename basic_ostream<_CharT, _Traits>::ios_base;
2976 const typename __ios_base::fmtflags __flags = __os.flags();
2977 const _CharT __fill = __os.fill();
2979 const _CharT __space = __os.widen(
' ');
2980 __os.flags(__ios_base::scientific | __ios_base::left);
2985 __os << __int.size() - 1;
2987 for (
auto __xit = __int.begin(); __xit != __int.end(); ++__xit)
2988 __os << __space << *__xit;
2991 for (
auto __dit = __den.begin(); __dit != __den.end(); ++__dit)
2992 __os << __space << *__dit;
2994 __os.flags(__flags);
2996 __os.precision(__precision);
3000 template<
typename _RealType,
typename _CharT,
typename _Traits>
3003 piecewise_constant_distribution<_RealType>& __x)
3005 using __ios_base =
typename basic_istream<_CharT, _Traits>::ios_base;
3007 const typename __ios_base::fmtflags __flags = __is.flags();
3008 __is.flags(__ios_base::dec | __ios_base::skipws);
3014 if (__detail::__extract_params(__is, __int_vec, __n + 1))
3017 if (__detail::__extract_params(__is, __den_vec, __n))
3019 __x.param({ __int_vec.begin(), __int_vec.end(),
3020 __den_vec.begin() });
3025 __is.flags(__flags);
3030 template<
typename _RealType>
3032 piecewise_linear_distribution<_RealType>::param_type::
3035 if (_M_int.size() < 2
3036 || (_M_int.size() == 2
3037 && _M_int[0] == _RealType(0)
3038 && _M_int[1] == _RealType(1)
3039 && _M_den[0] == _M_den[1]))
3047 _M_cp.reserve(_M_int.size() - 1);
3048 _M_m.reserve(_M_int.size() - 1);
3049 for (
size_t __k = 0; __k < _M_int.size() - 1; ++__k)
3051 const _RealType __delta = _M_int[__k + 1] - _M_int[__k];
3052 __sum += 0.5 * (_M_den[__k + 1] + _M_den[__k]) * __delta;
3053 _M_cp.push_back(__sum);
3054 _M_m.push_back((_M_den[__k + 1] - _M_den[__k]) / __delta);
3056 __glibcxx_assert(__sum > 0);
3059 __detail::__normalize(_M_den.begin(), _M_den.end(), _M_den.begin(),
3062 __detail::__normalize(_M_cp.begin(), _M_cp.end(), _M_cp.begin(), __sum);
3064 __detail::__normalize(_M_m.begin(), _M_m.end(), _M_m.begin(), __sum);
3067 _M_cp[_M_cp.size() - 1] = 1.0;
3070 template<
typename _RealType>
3071 template<
typename _InputIteratorB,
typename _InputIteratorW>
3072 piecewise_linear_distribution<_RealType>::param_type::
3073 param_type(_InputIteratorB __bbegin,
3074 _InputIteratorB __bend,
3075 _InputIteratorW __wbegin)
3076 : _M_int(), _M_den(), _M_cp(), _M_m()
3078 for (; __bbegin != __bend; ++__bbegin, ++__wbegin)
3080 _M_int.push_back(*__bbegin);
3081 _M_den.push_back(*__wbegin);
3087 template<
typename _RealType>
3088 template<
typename _Func>
3089 piecewise_linear_distribution<_RealType>::param_type::
3090 param_type(initializer_list<_RealType> __bl, _Func __fw)
3091 : _M_int(), _M_den(), _M_cp(), _M_m()
3093 _M_int.reserve(__bl.size());
3094 _M_den.reserve(__bl.size());
3095 for (
auto __biter = __bl.begin(); __biter != __bl.end(); ++__biter)
3097 _M_int.push_back(*__biter);
3098 _M_den.push_back(__fw(*__biter));
3104 template<
typename _RealType>
3105 template<
typename _Func>
3106 piecewise_linear_distribution<_RealType>::param_type::
3107 param_type(
size_t __nw, _RealType __xmin, _RealType __xmax, _Func __fw)
3108 : _M_int(), _M_den(), _M_cp(), _M_m()
3110 const size_t __n = __nw == 0 ? 1 : __nw;
3111 const _RealType __delta = (__xmax - __xmin) / __n;
3113 _M_int.reserve(__n + 1);
3114 _M_den.reserve(__n + 1);
3115 for (
size_t __k = 0; __k <= __nw; ++__k)
3117 _M_int.push_back(__xmin + __k * __delta);
3118 _M_den.push_back(__fw(_M_int[__k] + __delta));
3124 template<
typename _RealType>
3125 template<
typename _UniformRandomNumberGenerator>
3126 typename piecewise_linear_distribution<_RealType>::result_type
3127 piecewise_linear_distribution<_RealType>::
3128 operator()(_UniformRandomNumberGenerator& __urng,
3129 const param_type& __param)
3131 __detail::_Adaptor<_UniformRandomNumberGenerator, double>
3134 const double __p = __aurng();
3135 if (__param._M_cp.empty())
3138 auto __pos = std::lower_bound(__param._M_cp.begin(),
3139 __param._M_cp.end(), __p);
3140 const size_t __i = __pos - __param._M_cp.begin();
3142 const double __pref = __i > 0 ? __param._M_cp[__i - 1] : 0.0;
3144 const double __a = 0.5 * __param._M_m[__i];
3145 const double __b = __param._M_den[__i];
3146 const double __cm = __p - __pref;
3148 _RealType __x = __param._M_int[__i];
3153 const double __d = __b * __b + 4.0 * __a * __cm;
3154 __x += 0.5 * (
std::sqrt(__d) - __b) / __a;
3160 template<
typename _RealType>
3161 template<
typename _ForwardIterator,
3162 typename _UniformRandomNumberGenerator>
3164 piecewise_linear_distribution<_RealType>::
3165 __generate_impl(_ForwardIterator __f, _ForwardIterator __t,
3166 _UniformRandomNumberGenerator& __urng,
3167 const param_type& __param)
3169 __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
3172 *__f++ = this->operator()(__urng, __param);
3175 template<
typename _RealType,
typename _CharT,
typename _Traits>
3178 const piecewise_linear_distribution<_RealType>& __x)
3180 using __ios_base =
typename basic_ostream<_CharT, _Traits>::ios_base;
3182 const typename __ios_base::fmtflags __flags = __os.flags();
3183 const _CharT __fill = __os.fill();
3185 const _CharT __space = __os.widen(
' ');
3186 __os.flags(__ios_base::scientific | __ios_base::left);
3191 __os << __int.size() - 1;
3193 for (
auto __xit = __int.begin(); __xit != __int.end(); ++__xit)
3194 __os << __space << *__xit;
3197 for (
auto __dit = __den.begin(); __dit != __den.end(); ++__dit)
3198 __os << __space << *__dit;
3200 __os.flags(__flags);
3202 __os.precision(__precision);
3206 template<
typename _RealType,
typename _CharT,
typename _Traits>
3209 piecewise_linear_distribution<_RealType>& __x)
3211 using __ios_base =
typename basic_istream<_CharT, _Traits>::ios_base;
3213 const typename __ios_base::fmtflags __flags = __is.flags();
3214 __is.flags(__ios_base::dec | __ios_base::skipws);
3219 vector<_RealType> __int_vec;
3220 if (__detail::__extract_params(__is, __int_vec, __n + 1))
3222 vector<double> __den_vec;
3223 if (__detail::__extract_params(__is, __den_vec, __n + 1))
3225 __x.param({ __int_vec.begin(), __int_vec.end(),
3226 __den_vec.begin() });
3230 __is.flags(__flags);
3235 template<
typename _IntType,
typename>
3238 _M_v.reserve(__il.size());
3239 for (
auto __iter = __il.begin(); __iter != __il.end(); ++__iter)
3240 _M_v.push_back(__detail::__mod<result_type,
3241 __detail::_Shift<result_type, 32>::__value>(*__iter));
3244 template<
typename _InputIterator>
3245 seed_seq::seed_seq(_InputIterator __begin, _InputIterator __end)
3247 if _GLIBCXX17_CONSTEXPR (__is_random_access_iter<_InputIterator>::value)
3250 for (_InputIterator __iter = __begin; __iter != __end; ++__iter)
3251 _M_v.push_back(__detail::__mod<result_type,
3252 __detail::_Shift<result_type, 32>::__value>(*__iter));
3255 template<
typename _RandomAccessIterator>
3257 seed_seq::generate(_RandomAccessIterator __begin,
3258 _RandomAccessIterator __end)
3260 typedef typename iterator_traits<_RandomAccessIterator>::value_type
3263 if (__begin == __end)
3266 std::fill(__begin, __end, _Type(0x8b8b8b8bu));
3268 const size_t __n = __end - __begin;
3269 const size_t __s = _M_v.size();
3270 const size_t __t = (__n >= 623) ? 11
3275 const size_t __p = (__n - __t) / 2;
3276 const size_t __q = __p + __t;
3277 const size_t __m =
std::max(
size_t(__s + 1), __n);
3279#ifndef __UINT32_TYPE__
3282 _Up(uint_least32_t v) : _M_v(v & 0xffffffffu) { }
3284 operator uint_least32_t()
const {
return _M_v; }
3286 uint_least32_t _M_v;
3288 using uint32_t = _Up;
3293 uint32_t __r1 = 1371501266u;
3294 uint32_t __r2 = __r1 + __s;
3295 __begin[__p] += __r1;
3296 __begin[__q] = (uint32_t)__begin[__q] + __r2;
3300 for (
size_t __k = 1; __k <= __s; ++__k)
3302 const size_t __kn = __k % __n;
3303 const size_t __kpn = (__k + __p) % __n;
3304 const size_t __kqn = (__k + __q) % __n;
3305 uint32_t __arg = (__begin[__kn]
3307 ^ __begin[(__k - 1) % __n]);
3308 uint32_t __r1 = 1664525u * (__arg ^ (__arg >> 27));
3309 uint32_t __r2 = __r1 + (uint32_t)__kn + _M_v[__k - 1];
3310 __begin[__kpn] = (uint32_t)__begin[__kpn] + __r1;
3311 __begin[__kqn] = (uint32_t)__begin[__kqn] + __r2;
3312 __begin[__kn] = __r2;
3315 for (
size_t __k = __s + 1; __k < __m; ++__k)
3317 const size_t __kn = __k % __n;
3318 const size_t __kpn = (__k + __p) % __n;
3319 const size_t __kqn = (__k + __q) % __n;
3320 uint32_t __arg = (__begin[__kn]
3322 ^ __begin[(__k - 1) % __n]);
3323 uint32_t __r1 = 1664525u * (__arg ^ (__arg >> 27));
3324 uint32_t __r2 = __r1 + (uint32_t)__kn;
3325 __begin[__kpn] = (uint32_t)__begin[__kpn] + __r1;
3326 __begin[__kqn] = (uint32_t)__begin[__kqn] + __r2;
3327 __begin[__kn] = __r2;
3330 for (
size_t __k = __m; __k < __m + __n; ++__k)
3332 const size_t __kn = __k % __n;
3333 const size_t __kpn = (__k + __p) % __n;
3334 const size_t __kqn = (__k + __q) % __n;
3335 uint32_t __arg = (__begin[__kn]
3337 + __begin[(__k - 1) % __n]);
3338 uint32_t __r3 = 1566083941u * (__arg ^ (__arg >> 27));
3339 uint32_t __r4 = __r3 - __kn;
3340 __begin[__kpn] ^= __r3;
3341 __begin[__kqn] ^= __r4;
3342 __begin[__kn] = __r4;
3346 template<
typename _RealType,
size_t __bits,
3347 typename _UniformRandomNumberGenerator>
3352 "template argument must be a floating point type");
3357 const long double __r =
static_cast<long double>(
__urng.max())
3358 -
static_cast<long double>(
__urng.min()) + 1.0L;
3363 _RealType
__sum = _RealType(0);
3364 _RealType
__tmp = _RealType(1);
3373#if _GLIBCXX_USE_C99_MATH_FUNCS
3374 __ret = std::nextafter(_RealType(1), _RealType(0));
3376 __ret = _RealType(1)
3383_GLIBCXX_END_NAMESPACE_VERSION
complex< _Tp > log(const complex< _Tp > &)
Return complex natural logarithm of z.
complex< _Tp > tan(const complex< _Tp > &)
Return complex tangent of z.
_Tp abs(const complex< _Tp > &)
Return magnitude of z.
complex< _Tp > exp(const complex< _Tp > &)
Return complex base e exponential of z.
complex< _Tp > pow(const complex< _Tp > &, int)
Return x to the y'th power.
complex< _Tp > sqrt(const complex< _Tp > &)
Return complex square root of z.
constexpr const _Tp & max(const _Tp &, const _Tp &)
This does what you think it does.
constexpr const _Tp & min(const _Tp &, const _Tp &)
This does what you think it does.
_RealType generate_canonical(_UniformRandomNumberGenerator &__g)
A function template for converting the output of a (integral) uniform random number generator to a fl...
constexpr back_insert_iterator< _Container > back_inserter(_Container &__x)
constexpr _Tp accumulate(_InputIterator __first, _InputIterator __last, _Tp __init)
Accumulate values in a range.
constexpr _OutputIterator partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __result)
Return list of partial sums.
ISO C++ entities toplevel namespace is std.
constexpr iterator_traits< _InputIterator >::difference_type distance(_InputIterator __first, _InputIterator __last)
A generalization of pointer arithmetic.
constexpr _Tp __lg(_Tp __n)
This is a helper function for the sort routines and for random.tcc.
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.
Template class basic_istream.
Template class basic_ostream.
static constexpr bool is_integer
static constexpr int digits
static constexpr bool is_signed
Properties of fundamental types.
static constexpr _Tp max() noexcept
static constexpr _Tp epsilon() noexcept
A model of a linear congruential random number generator.
static constexpr result_type multiplier
static constexpr result_type modulus
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
The Marsaglia-Zaman generator.
void seed(result_type __sd=0u)
Seeds the initial state of the random number generator.
result_type operator()()
Gets the next random number in the sequence.
result_type operator()()
Gets the next value in the generated random number sequence.
result_type operator()()
Gets the next value in the generated random number sequence.
Produces random numbers by reordering random numbers from some base engine.
_RandomNumberEngine::result_type result_type
Uniform continuous distribution for random numbers.
A normal continuous distribution for random numbers.
result_type operator()(_UniformRandomNumberGenerator &__urng)
Generating functions.
A gamma continuous distribution for random numbers.
result_type operator()(_UniformRandomNumberGenerator &__urng)
Generating functions.
A chi_squared_distribution random number distribution.
A cauchy_distribution random number distribution.
result_type operator()(_UniformRandomNumberGenerator &__urng)
Generating functions.
A fisher_f_distribution random number distribution.
A student_t_distribution random number distribution.
A discrete binomial random number distribution.
result_type operator()(_UniformRandomNumberGenerator &__urng)
Generating functions.
A discrete geometric random number distribution.
result_type operator()(_UniformRandomNumberGenerator &__urng)
Generating functions.
result_type operator()(_UniformRandomNumberGenerator &__urng)
Generating functions.
A discrete Poisson random number distribution.
result_type operator()(_UniformRandomNumberGenerator &__urng)
Generating functions.
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...
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.
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.
An exponential continuous distribution for random numbers.
A weibull_distribution random number distribution.
result_type operator()(_UniformRandomNumberGenerator &__urng)
Generating functions.
A extreme_value_distribution random number distribution.
result_type operator()(_UniformRandomNumberGenerator &__urng)
Generating functions.
A discrete_distribution random number distribution.
Parallel STL function calls corresponding to stl_numeric.h. The functions defined here mainly do case...