35 namespace std _GLIBCXX_VISIBILITY(default)
42 _GLIBCXX_BEGIN_NAMESPACE_VERSION
54 template<
typename _Tp, _Tp __m, _Tp __a, _Tp __c,
bool>
64 static const _Tp __q = __m / __a;
65 static const _Tp __r = __m % __a;
67 _Tp __t1 = __a * (__x % __q);
68 _Tp __t2 = __r * (__x / __q);
72 __x = __m - __t2 + __t1;
77 const _Tp __d = __m - __x;
89 template<
typename _Tp, _Tp __m, _Tp __a, _Tp __c>
90 struct _Mod<_Tp, __m, __a, __c, true>
94 {
return __a * __x + __c; }
97 template<
typename _InputIterator,
typename _OutputIterator,
98 typename _UnaryOperation>
100 __transform(_InputIterator __first, _InputIterator __last,
101 _OutputIterator __result, _UnaryOperation __unary_op)
103 for (; __first != __last; ++__first, ++__result)
104 *__result = __unary_op(*__first);
108 _GLIBCXX_END_NAMESPACE_VERSION
111 _GLIBCXX_BEGIN_NAMESPACE_VERSION
113 template<
typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
115 linear_congruential_engine<_UIntType, __a, __c, __m>::multiplier;
117 template<
typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
119 linear_congruential_engine<_UIntType, __a, __c, __m>::increment;
121 template<
typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
123 linear_congruential_engine<_UIntType, __a, __c, __m>::modulus;
125 template<
typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
127 linear_congruential_engine<_UIntType, __a, __c, __m>::default_seed;
133 template<
typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
138 if ((__detail::__mod<_UIntType, __m>(__c) == 0)
139 && (__detail::__mod<_UIntType, __m>(__s) == 0))
142 _M_x = __detail::__mod<_UIntType, __m>(__s);
148 template<
typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
149 template<
typename _Sseq>
156 const _UIntType __k = (__k0 + 31) / 32;
157 uint_least32_t __arr[__k + 3];
158 __q.generate(__arr + 0, __arr + __k + 3);
159 _UIntType __factor = 1u;
160 _UIntType __sum = 0u;
161 for (
size_t __j = 0; __j < __k; ++__j)
163 __sum += __arr[__j + 3] * __factor;
164 __factor *= __detail::_Shift<_UIntType, 32>::__value;
169 template<
typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m,
170 typename _CharT,
typename _Traits>
172 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
174 __a, __c, __m>& __lcr)
177 typedef typename __ostream_type::ios_base __ios_base;
179 const typename __ios_base::fmtflags __flags = __os.
flags();
180 const _CharT __fill = __os.fill();
182 __os.fill(__os.widen(
' '));
191 template<
typename _UIntType, _UIntType __a, _UIntType __c, _UIntType __m,
192 typename _CharT,
typename _Traits>
195 linear_congruential_engine<_UIntType, __a, __c, __m>& __lcr)
198 typedef typename __istream_type::ios_base __ios_base;
200 const typename __ios_base::fmtflags __flags = __is.
flags();
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>::word_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>::state_size;
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>::shift_size;
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>::mask_bits;
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>::xor_mask;
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_u;
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_d;
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_s;
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_b;
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_t;
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>::tempering_c;
309 template<
typename _UIntType,
310 size_t __w,
size_t __n,
size_t __m,
size_t __r,
311 _UIntType __a,
size_t __u, _UIntType __d,
size_t __s,
312 _UIntType __b,
size_t __t, _UIntType __c,
size_t __l,
315 mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
316 __s, __b, __t, __c, __l, __f>::tempering_l;
318 template<
typename _UIntType,
319 size_t __w,
size_t __n,
size_t __m,
size_t __r,
320 _UIntType __a,
size_t __u, _UIntType __d,
size_t __s,
321 _UIntType __b,
size_t __t, _UIntType __c,
size_t __l,
324 mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
325 __s, __b, __t, __c, __l, __f>::
326 initialization_multiplier;
328 template<
typename _UIntType,
329 size_t __w,
size_t __n,
size_t __m,
size_t __r,
330 _UIntType __a,
size_t __u, _UIntType __d,
size_t __s,
331 _UIntType __b,
size_t __t, _UIntType __c,
size_t __l,
334 mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
335 __s, __b, __t, __c, __l, __f>::default_seed;
337 template<
typename _UIntType,
338 size_t __w,
size_t __n,
size_t __m,
size_t __r,
339 _UIntType __a,
size_t __u, _UIntType __d,
size_t __s,
340 _UIntType __b,
size_t __t, _UIntType __c,
size_t __l,
343 mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
344 __s, __b, __t, __c, __l, __f>::
345 seed(result_type __sd)
347 _M_x[0] = __detail::__mod<_UIntType,
348 __detail::_Shift<_UIntType, __w>::__value>(__sd);
350 for (
size_t __i = 1; __i < state_size; ++__i)
352 _UIntType __x = _M_x[__i - 1];
353 __x ^= __x >> (__w - 2);
355 __x += __detail::__mod<_UIntType, __n>(__i);
356 _M_x[__i] = __detail::__mod<_UIntType,
357 __detail::_Shift<_UIntType, __w>::__value>(__x);
362 template<
typename _UIntType,
363 size_t __w,
size_t __n,
size_t __m,
size_t __r,
364 _UIntType __a,
size_t __u, _UIntType __d,
size_t __s,
365 _UIntType __b,
size_t __t, _UIntType __c,
size_t __l,
367 template<
typename _Sseq>
369 mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
370 __s, __b, __t, __c, __l, __f>::
373 const _UIntType __upper_mask = (~_UIntType()) << __r;
374 const size_t __k = (__w + 31) / 32;
375 uint_least32_t __arr[__n * __k];
376 __q.generate(__arr + 0, __arr + __n * __k);
379 for (
size_t __i = 0; __i < state_size; ++__i)
381 _UIntType __factor = 1u;
382 _UIntType __sum = 0u;
383 for (
size_t __j = 0; __j < __k; ++__j)
385 __sum += __arr[__k * __i + __j] * __factor;
386 __factor *= __detail::_Shift<_UIntType, 32>::__value;
388 _M_x[__i] = __detail::__mod<_UIntType,
389 __detail::_Shift<_UIntType, __w>::__value>(__sum);
395 if ((_M_x[0] & __upper_mask) != 0u)
398 else if (_M_x[__i] != 0u)
403 _M_x[0] = __detail::_Shift<_UIntType, __w - 1>::__value;
407 template<
typename _UIntType,
size_t __w,
408 size_t __n,
size_t __m,
size_t __r,
409 _UIntType __a,
size_t __u, _UIntType __d,
size_t __s,
410 _UIntType __b,
size_t __t, _UIntType __c,
size_t __l,
413 mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
414 __s, __b, __t, __c, __l, __f>::result_type
415 mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
416 __s, __b, __t, __c, __l, __f>::
420 if (_M_p >= state_size)
422 const _UIntType __upper_mask = (~_UIntType()) << __r;
423 const _UIntType __lower_mask = ~__upper_mask;
425 for (
size_t __k = 0; __k < (__n - __m); ++__k)
427 _UIntType __y = ((_M_x[__k] & __upper_mask)
428 | (_M_x[__k + 1] & __lower_mask));
429 _M_x[__k] = (_M_x[__k + __m] ^ (__y >> 1)
430 ^ ((__y & 0x01) ? __a : 0));
433 for (
size_t __k = (__n - __m); __k < (__n - 1); ++__k)
435 _UIntType __y = ((_M_x[__k] & __upper_mask)
436 | (_M_x[__k + 1] & __lower_mask));
437 _M_x[__k] = (_M_x[__k + (__m - __n)] ^ (__y >> 1)
438 ^ ((__y & 0x01) ? __a : 0));
441 _UIntType __y = ((_M_x[__n - 1] & __upper_mask)
442 | (_M_x[0] & __lower_mask));
443 _M_x[__n - 1] = (_M_x[__m - 1] ^ (__y >> 1)
444 ^ ((__y & 0x01) ? __a : 0));
449 result_type __z = _M_x[_M_p++];
450 __z ^= (__z >> __u) & __d;
451 __z ^= (__z << __s) & __b;
452 __z ^= (__z << __t) & __c;
458 template<
typename _UIntType,
size_t __w,
459 size_t __n,
size_t __m,
size_t __r,
460 _UIntType __a,
size_t __u, _UIntType __d,
size_t __s,
461 _UIntType __b,
size_t __t, _UIntType __c,
size_t __l,
462 _UIntType __f,
typename _CharT,
typename _Traits>
464 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
465 const mersenne_twister_engine<_UIntType, __w, __n, __m,
466 __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>& __x)
469 typedef typename __ostream_type::ios_base __ios_base;
471 const typename __ios_base::fmtflags __flags = __os.
flags();
472 const _CharT __fill = __os.fill();
473 const _CharT __space = __os.widen(
' ');
477 for (
size_t __i = 0; __i < __n; ++__i)
478 __os << __x._M_x[__i] << __space;
486 template<
typename _UIntType,
size_t __w,
487 size_t __n,
size_t __m,
size_t __r,
488 _UIntType __a,
size_t __u, _UIntType __d,
size_t __s,
489 _UIntType __b,
size_t __t, _UIntType __c,
size_t __l,
490 _UIntType __f,
typename _CharT,
typename _Traits>
493 mersenne_twister_engine<_UIntType, __w, __n, __m,
494 __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>& __x)
497 typedef typename __istream_type::ios_base __ios_base;
499 const typename __ios_base::fmtflags __flags = __is.
flags();
502 for (
size_t __i = 0; __i < __n; ++__i)
503 __is >> __x._M_x[__i];
511 template<
typename _UIntType,
size_t __w,
size_t __s,
size_t __r>
513 subtract_with_carry_engine<_UIntType, __w, __s, __r>::word_size;
515 template<
typename _UIntType,
size_t __w,
size_t __s,
size_t __r>
517 subtract_with_carry_engine<_UIntType, __w, __s, __r>::short_lag;
519 template<
typename _UIntType,
size_t __w,
size_t __s,
size_t __r>
521 subtract_with_carry_engine<_UIntType, __w, __s, __r>::long_lag;
523 template<
typename _UIntType,
size_t __w,
size_t __s,
size_t __r>
525 subtract_with_carry_engine<_UIntType, __w, __s, __r>::default_seed;
527 template<
typename _UIntType,
size_t __w,
size_t __s,
size_t __r>
529 subtract_with_carry_engine<_UIntType, __w, __s, __r>::
530 seed(result_type __value)
533 __lcg(__value == 0u ? default_seed : __value);
535 const size_t __n = (__w + 31) / 32;
537 for (
size_t __i = 0; __i < long_lag; ++__i)
539 _UIntType __sum = 0u;
540 _UIntType __factor = 1u;
541 for (
size_t __j = 0; __j < __n; ++__j)
543 __sum += __detail::__mod<uint_least32_t,
544 __detail::_Shift<uint_least32_t, 32>::__value>
545 (__lcg()) * __factor;
546 __factor *= __detail::_Shift<_UIntType, 32>::__value;
548 _M_x[__i] = __detail::__mod<_UIntType,
549 __detail::_Shift<_UIntType, __w>::__value>(__sum);
551 _M_carry = (_M_x[long_lag - 1] == 0) ? 1 : 0;
555 template<
typename _UIntType,
size_t __w,
size_t __s,
size_t __r>
556 template<
typename _Sseq>
558 subtract_with_carry_engine<_UIntType, __w, __s, __r>::
561 const size_t __k = (__w + 31) / 32;
562 uint_least32_t __arr[__r * __k];
563 __q.generate(__arr + 0, __arr + __r * __k);
565 for (
size_t __i = 0; __i < long_lag; ++__i)
567 _UIntType __sum = 0u;
568 _UIntType __factor = 1u;
569 for (
size_t __j = 0; __j < __k; ++__j)
571 __sum += __arr[__k * __i + __j] * __factor;
572 __factor *= __detail::_Shift<_UIntType, 32>::__value;
574 _M_x[__i] = __detail::__mod<_UIntType,
575 __detail::_Shift<_UIntType, __w>::__value>(__sum);
577 _M_carry = (_M_x[long_lag - 1] == 0) ? 1 : 0;
581 template<
typename _UIntType,
size_t __w,
size_t __s,
size_t __r>
582 typename subtract_with_carry_engine<_UIntType, __w, __s, __r>::
584 subtract_with_carry_engine<_UIntType, __w, __s, __r>::
588 long __ps = _M_p - short_lag;
596 if (_M_x[__ps] >= _M_x[_M_p] + _M_carry)
598 __xi = _M_x[__ps] - _M_x[_M_p] - _M_carry;
603 __xi = (__detail::_Shift<_UIntType, __w>::__value
604 - _M_x[_M_p] - _M_carry + _M_x[__ps]);
610 if (++_M_p >= long_lag)
616 template<
typename _UIntType,
size_t __w,
size_t __s,
size_t __r,
617 typename _CharT,
typename _Traits>
619 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
620 const subtract_with_carry_engine<_UIntType,
624 typedef typename __ostream_type::ios_base __ios_base;
626 const typename __ios_base::fmtflags __flags = __os.
flags();
627 const _CharT __fill = __os.fill();
628 const _CharT __space = __os.widen(
' ');
632 for (
size_t __i = 0; __i < __r; ++__i)
633 __os << __x._M_x[__i] << __space;
634 __os << __x._M_carry << __space << __x._M_p;
641 template<
typename _UIntType,
size_t __w,
size_t __s,
size_t __r,
642 typename _CharT,
typename _Traits>
645 subtract_with_carry_engine<_UIntType, __w, __s, __r>& __x)
648 typedef typename __istream_type::ios_base __ios_base;
650 const typename __ios_base::fmtflags __flags = __is.
flags();
653 for (
size_t __i = 0; __i < __r; ++__i)
654 __is >> __x._M_x[__i];
655 __is >> __x._M_carry;
663 template<
typename _RandomNumberEngine,
size_t __p,
size_t __r>
665 discard_block_engine<_RandomNumberEngine, __p, __r>::block_size;
667 template<
typename _RandomNumberEngine,
size_t __p,
size_t __r>
669 discard_block_engine<_RandomNumberEngine, __p, __r>::used_block;
671 template<
typename _RandomNumberEngine,
size_t __p,
size_t __r>
672 typename discard_block_engine<_RandomNumberEngine,
673 __p, __r>::result_type
677 if (_M_n >= used_block)
679 _M_b.discard(block_size - _M_n);
686 template<
typename _RandomNumberEngine,
size_t __p,
size_t __r,
687 typename _CharT,
typename _Traits>
689 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
694 typedef typename __ostream_type::ios_base __ios_base;
696 const typename __ios_base::fmtflags __flags = __os.
flags();
697 const _CharT __fill = __os.fill();
698 const _CharT __space = __os.widen(
' ');
702 __os << __x.base() << __space << __x._M_n;
709 template<
typename _RandomNumberEngine,
size_t __p,
size_t __r,
710 typename _CharT,
typename _Traits>
713 discard_block_engine<_RandomNumberEngine, __p, __r>& __x)
716 typedef typename __istream_type::ios_base __ios_base;
718 const typename __ios_base::fmtflags __flags = __is.
flags();
721 __is >> __x._M_b >> __x._M_n;
728 template<
typename _RandomNumberEngine,
size_t __w,
typename _UIntType>
729 typename independent_bits_engine<_RandomNumberEngine, __w, _UIntType>::
734 typedef typename _RandomNumberEngine::result_type _Eresult_type;
735 const _Eresult_type __r
737 ? _M_b.max() - _M_b.min() + 1 : 0);
739 const unsigned __m = __r ?
std::__lg(__r) : __edig;
746 __ctype __s0, __s1, __y0, __y1;
748 for (
size_t __i = 0; __i < 2; ++__i)
750 __n = (__w + __m - 1) / __m + __i;
751 __n0 = __n - __w % __n;
752 const unsigned __w0 = __w / __n;
758 __s0 = __ctype(1) << __w0;
766 __y0 = __s0 * (__r / __s0);
768 __y1 = __s1 * (__r / __s1);
770 if (__r - __y0 <= __y0 / __n)
778 for (
size_t __k = 0; __k < __n0; ++__k)
782 __u = _M_b() - _M_b.
min();
783 while (__y0 && __u >= __y0);
784 __sum = __s0 * __sum + (__s0 ? __u % __s0 : __u);
786 for (
size_t __k = __n0; __k < __n; ++__k)
790 __u = _M_b() - _M_b.min();
791 while (__y1 && __u >= __y1);
792 __sum = __s1 * __sum + (__s1 ? __u % __s1 : __u);
798 template<
typename _RandomNumberEngine,
size_t __k>
802 template<
typename _RandomNumberEngine,
size_t __k>
807 size_t __j = __k * ((_M_y - _M_b.min())
808 / (_M_b.max() - _M_b.min() + 1.0L));
815 template<
typename _RandomNumberEngine,
size_t __k,
816 typename _CharT,
typename _Traits>
818 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
822 typedef typename __ostream_type::ios_base __ios_base;
824 const typename __ios_base::fmtflags __flags = __os.
flags();
825 const _CharT __fill = __os.fill();
826 const _CharT __space = __os.widen(
' ');
831 for (
size_t __i = 0; __i < __k; ++__i)
832 __os << __space << __x._M_v[__i];
833 __os << __space << __x._M_y;
840 template<
typename _RandomNumberEngine,
size_t __k,
841 typename _CharT,
typename _Traits>
844 shuffle_order_engine<_RandomNumberEngine, __k>& __x)
847 typedef typename __istream_type::ios_base __ios_base;
849 const typename __ios_base::fmtflags __flags = __is.
flags();
853 for (
size_t __i = 0; __i < __k; ++__i)
854 __is >> __x._M_v[__i];
862 template<
typename _IntType>
863 template<
typename _UniformRandomNumberGenerator>
864 typename uniform_int_distribution<_IntType>::result_type
866 operator()(_UniformRandomNumberGenerator& __urng,
867 const param_type& __param)
869 typedef typename _UniformRandomNumberGenerator::result_type
871 typedef typename std::make_unsigned<result_type>::type __utype;
875 const __uctype __urngmin = __urng.min();
876 const __uctype __urngmax = __urng.max();
877 const __uctype __urngrange = __urngmax - __urngmin;
878 const __uctype __urange
879 = __uctype(__param.b()) - __uctype(__param.a());
883 if (__urngrange > __urange)
886 const __uctype __uerange = __urange + 1;
887 const __uctype __scaling = __urngrange / __uerange;
888 const __uctype __past = __uerange * __scaling;
890 __ret = __uctype(__urng()) - __urngmin;
891 while (__ret >= __past);
894 else if (__urngrange < __urange)
914 const __uctype __uerngrange = __urngrange + 1;
915 __tmp = (__uerngrange * operator()
916 (__urng, param_type(0, __urange / __uerngrange)));
917 __ret = __tmp + (__uctype(__urng()) - __urngmin);
919 while (__ret > __urange || __ret < __tmp);
922 __ret = __uctype(__urng()) - __urngmin;
924 return __ret + __param.a();
927 template<
typename _IntType,
typename _CharT,
typename _Traits>
929 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
933 typedef typename __ostream_type::ios_base __ios_base;
935 const typename __ios_base::fmtflags __flags = __os.
flags();
936 const _CharT __fill = __os.fill();
937 const _CharT __space = __os.widen(
' ');
941 __os << __x.a() << __space << __x.b();
948 template<
typename _IntType,
typename _CharT,
typename _Traits>
954 typedef typename __istream_type::ios_base __ios_base;
956 const typename __ios_base::fmtflags __flags = __is.
flags();
962 param_type(__a, __b));
969 template<
typename _RealType,
typename _CharT,
typename _Traits>
971 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
975 typedef typename __ostream_type::ios_base __ios_base;
977 const typename __ios_base::fmtflags __flags = __os.
flags();
978 const _CharT __fill = __os.fill();
980 const _CharT __space = __os.widen(
' ');
985 __os << __x.a() << __space << __x.b();
989 __os.precision(__precision);
993 template<
typename _RealType,
typename _CharT,
typename _Traits>
999 typedef typename __istream_type::ios_base __ios_base;
1001 const typename __ios_base::fmtflags __flags = __is.
flags();
1007 param_type(__a, __b));
1009 __is.
flags(__flags);
1014 template<
typename _CharT,
typename _Traits>
1016 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
1020 typedef typename __ostream_type::ios_base __ios_base;
1022 const typename __ios_base::fmtflags __flags = __os.
flags();
1023 const _CharT __fill = __os.fill();
1026 __os.fill(__os.widen(
' '));
1031 __os.flags(__flags);
1033 __os.precision(__precision);
1038 template<
typename _IntType>
1039 template<
typename _UniformRandomNumberGenerator>
1040 typename geometric_distribution<_IntType>::result_type
1042 operator()(_UniformRandomNumberGenerator& __urng,
1043 const param_type& __param)
1047 const double __naf =
1050 const double __thr =
1052 __detail::_Adaptor<_UniformRandomNumberGenerator, double>
1057 __cand = std::floor(
std::log(1.0 - __aurng()) / __param._M_log_1_p);
1058 while (__cand >= __thr);
1060 return result_type(__cand + __naf);
1063 template<
typename _IntType,
1064 typename _CharT,
typename _Traits>
1066 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
1070 typedef typename __ostream_type::ios_base __ios_base;
1072 const typename __ios_base::fmtflags __flags = __os.
flags();
1073 const _CharT __fill = __os.fill();
1076 __os.fill(__os.widen(
' '));
1081 __os.flags(__flags);
1083 __os.precision(__precision);
1087 template<
typename _IntType,
1088 typename _CharT,
typename _Traits>
1094 typedef typename __istream_type::ios_base __ios_base;
1096 const typename __ios_base::fmtflags __flags = __is.
flags();
1103 __is.
flags(__flags);
1108 template<
typename _IntType>
1109 template<
typename _UniformRandomNumberGenerator>
1110 typename negative_binomial_distribution<_IntType>::result_type
1112 operator()(_UniformRandomNumberGenerator& __urng)
1114 const double __y = _M_gd(__urng);
1118 return __poisson(__urng);
1121 template<
typename _IntType>
1122 template<
typename _UniformRandomNumberGenerator>
1123 typename negative_binomial_distribution<_IntType>::result_type
1125 operator()(_UniformRandomNumberGenerator& __urng,
1126 const param_type& __p)
1132 _M_gd(__urng, param_type(__p.k(), (1.0 - __p.p()) / __p.p()));
1135 return __poisson(__urng);
1138 template<
typename _IntType,
typename _CharT,
typename _Traits>
1140 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
1141 const negative_binomial_distribution<_IntType>& __x)
1144 typedef typename __ostream_type::ios_base __ios_base;
1146 const typename __ios_base::fmtflags __flags = __os.
flags();
1147 const _CharT __fill = __os.fill();
1149 const _CharT __space = __os.widen(
' ');
1151 __os.fill(__os.widen(
' '));
1154 __os << __x.k() << __space << __x.p()
1155 << __space << __x._M_gd;
1157 __os.flags(__flags);
1159 __os.precision(__precision);
1163 template<
typename _IntType,
typename _CharT,
typename _Traits>
1166 negative_binomial_distribution<_IntType>& __x)
1169 typedef typename __istream_type::ios_base __ios_base;
1171 const typename __ios_base::fmtflags __flags = __is.
flags();
1176 __is >> __k >> __p >> __x._M_gd;
1177 __x.param(
typename negative_binomial_distribution<_IntType>::
1178 param_type(__k, __p));
1180 __is.
flags(__flags);
1185 template<
typename _IntType>
1187 poisson_distribution<_IntType>::param_type::
1190 #if _GLIBCXX_USE_C99_MATH_TR1
1193 const double __m = std::floor(_M_mean);
1195 _M_lfm = std::lgamma(__m + 1);
1198 const double __pi_4 = 0.7853981633974483096156608458198757L;
1202 const double __cx = 2 * __m + _M_d;
1207 _M_cb = 2 * __cx *
std::exp(-_M_d * _M_1cx * (1 + _M_d / 2))
1225 template<
typename _IntType>
1226 template<
typename _UniformRandomNumberGenerator>
1227 typename poisson_distribution<_IntType>::result_type
1230 const param_type& __param)
1232 __detail::_Adaptor<_UniformRandomNumberGenerator, double>
1234 #if _GLIBCXX_USE_C99_MATH_TR1
1235 if (__param.mean() >= 12)
1240 const double __naf =
1242 const double __thr =
1245 const double __m = std::floor(__param.mean());
1247 const double __spi_2 = 1.2533141373155002512078826424055226L;
1248 const double __c1 = __param._M_sm * __spi_2;
1249 const double __c2 = __param._M_c2b + __c1;
1250 const double __c3 = __c2 + 1;
1251 const double __c4 = __c3 + 1;
1253 const double __e178 = 1.0129030479320018583185514777512983L;
1254 const double __c5 = __c4 + __e178;
1255 const double __c = __param._M_cb + __c5;
1256 const double __2cx = 2 * (2 * __m + __param._M_d);
1258 bool __reject =
true;
1261 const double __u = __c * __aurng();
1262 const double __e = -
std::log(1.0 - __aurng());
1268 const double __n = _M_nd(__urng);
1269 const double __y = -
std::abs(__n) * __param._M_sm - 1;
1270 __x = std::floor(__y);
1271 __w = -__n * __n / 2;
1275 else if (__u <= __c2)
1277 const double __n = _M_nd(__urng);
1278 const double __y = 1 +
std::abs(__n) * __param._M_scx;
1279 __x = std::ceil(__y);
1280 __w = __y * (2 - __y) * __param._M_1cx;
1281 if (__x > __param._M_d)
1284 else if (__u <= __c3)
1288 else if (__u <= __c4)
1290 else if (__u <= __c5)
1294 const double __v = -
std::log(1.0 - __aurng());
1295 const double __y = __param._M_d
1296 + __v * __2cx / __param._M_d;
1297 __x = std::ceil(__y);
1298 __w = -__param._M_d * __param._M_1cx * (1 + __y / 2);
1301 __reject = (__w - __e - __x * __param._M_lm_thr
1302 > __param._M_lfm - std::lgamma(__x + __m + 1));
1304 __reject |= __x + __m >= __thr;
1314 double __prod = 1.0;
1318 __prod *= __aurng();
1321 while (__prod > __param._M_lm_thr);
1327 template<
typename _IntType,
1328 typename _CharT,
typename _Traits>
1330 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
1334 typedef typename __ostream_type::ios_base __ios_base;
1336 const typename __ios_base::fmtflags __flags = __os.
flags();
1337 const _CharT __fill = __os.fill();
1339 const _CharT __space = __os.widen(
' ');
1344 __os << __x.mean() << __space << __x._M_nd;
1346 __os.flags(__flags);
1348 __os.precision(__precision);
1352 template<
typename _IntType,
1353 typename _CharT,
typename _Traits>
1356 poisson_distribution<_IntType>& __x)
1359 typedef typename __istream_type::ios_base __ios_base;
1361 const typename __ios_base::fmtflags __flags = __is.
flags();
1365 __is >> __mean >> __x._M_nd;
1366 __x.param(
typename poisson_distribution<_IntType>::param_type(__mean));
1368 __is.
flags(__flags);
1373 template<
typename _IntType>
1375 binomial_distribution<_IntType>::param_type::
1378 const double __p12 = _M_p <= 0.5 ? _M_p : 1.0 - _M_p;
1382 #if _GLIBCXX_USE_C99_MATH_TR1
1383 if (_M_t * __p12 >= 8)
1386 const double __np = std::floor(_M_t * __p12);
1387 const double __pa = __np / _M_t;
1388 const double __1p = 1 - __pa;
1390 const double __pi_4 = 0.7853981633974483096156608458198757L;
1391 const double __d1x =
1393 / (81 * __pi_4 * __1p)));
1394 _M_d1 = std::round(
std::max(1.0, __d1x));
1395 const double __d2x =
1397 / (__pi_4 * __pa)));
1398 _M_d2 = std::round(
std::max(1.0, __d2x));
1401 const double __spi_2 = 1.2533141373155002512078826424055226L;
1402 _M_s1 =
std::sqrt(__np * __1p) * (1 + _M_d1 / (4 * __np));
1403 _M_s2 =
std::sqrt(__np * __1p) * (1 + _M_d2 / (4 * _M_t * __1p));
1404 _M_c = 2 * _M_d1 / __np;
1405 _M_a1 =
std::exp(_M_c) * _M_s1 * __spi_2;
1406 const double __a12 = _M_a1 + _M_s2 * __spi_2;
1407 const double __s1s = _M_s1 * _M_s1;
1408 _M_a123 = __a12 + (
std::exp(_M_d1 / (_M_t * __1p))
1410 *
std::exp(-_M_d1 * _M_d1 / (2 * __s1s)));
1411 const double __s2s = _M_s2 * _M_s2;
1412 _M_s = (_M_a123 + 2 * __s2s / _M_d2
1413 *
std::exp(-_M_d2 * _M_d2 / (2 * __s2s)));
1414 _M_lf = (std::lgamma(__np + 1)
1415 + std::lgamma(_M_t - __np + 1));
1418 _M_q = -
std::log(1 - (__p12 - __pa) / __1p);
1425 template<
typename _IntType>
1426 template<
typename _UniformRandomNumberGenerator>
1427 typename binomial_distribution<_IntType>::result_type
1428 binomial_distribution<_IntType>::
1429 _M_waiting(_UniformRandomNumberGenerator& __urng, _IntType __t)
1433 __detail::_Adaptor<_UniformRandomNumberGenerator, double>
1438 const double __e = -
std::log(1.0 - __aurng());
1439 __sum += __e / (__t - __x);
1442 while (__sum <= _M_param._M_q);
1457 template<
typename _IntType>
1458 template<
typename _UniformRandomNumberGenerator>
1459 typename binomial_distribution<_IntType>::result_type
1462 const param_type& __param)
1465 const _IntType __t = __param.t();
1466 const double __p = __param.p();
1467 const double __p12 = __p <= 0.5 ? __p : 1.0 - __p;
1468 __detail::_Adaptor<_UniformRandomNumberGenerator, double>
1471 #if _GLIBCXX_USE_C99_MATH_TR1
1472 if (!__param._M_easy)
1477 const double __naf =
1479 const double __thr =
1482 const double __np = std::floor(__t * __p12);
1485 const double __spi_2 = 1.2533141373155002512078826424055226L;
1486 const double __a1 = __param._M_a1;
1487 const double __a12 = __a1 + __param._M_s2 * __spi_2;
1488 const double __a123 = __param._M_a123;
1489 const double __s1s = __param._M_s1 * __param._M_s1;
1490 const double __s2s = __param._M_s2 * __param._M_s2;
1495 const double __u = __param._M_s * __aurng();
1501 const double __n = _M_nd(__urng);
1502 const double __y = __param._M_s1 *
std::abs(__n);
1503 __reject = __y >= __param._M_d1;
1506 const double __e = -
std::log(1.0 - __aurng());
1507 __x = std::floor(__y);
1508 __v = -__e - __n * __n / 2 + __param._M_c;
1511 else if (__u <= __a12)
1513 const double __n = _M_nd(__urng);
1514 const double __y = __param._M_s2 *
std::abs(__n);
1515 __reject = __y >= __param._M_d2;
1518 const double __e = -
std::log(1.0 - __aurng());
1519 __x = std::floor(-__y);
1520 __v = -__e - __n * __n / 2;
1523 else if (__u <= __a123)
1525 const double __e1 = -
std::log(1.0 - __aurng());
1526 const double __e2 = -
std::log(1.0 - __aurng());
1528 const double __y = __param._M_d1
1529 + 2 * __s1s * __e1 / __param._M_d1;
1530 __x = std::floor(__y);
1531 __v = (-__e2 + __param._M_d1 * (1 / (__t - __np)
1532 -__y / (2 * __s1s)));
1537 const double __e1 = -
std::log(1.0 - __aurng());
1538 const double __e2 = -
std::log(1.0 - __aurng());
1540 const double __y = __param._M_d2
1541 + 2 * __s2s * __e1 / __param._M_d2;
1542 __x = std::floor(-__y);
1543 __v = -__e2 - __param._M_d2 * __y / (2 * __s2s);
1547 __reject = __reject || __x < -__np || __x > __t - __np;
1550 const double __lfx =
1551 std::lgamma(__np + __x + 1)
1552 + std::lgamma(__t - (__np + __x) + 1);
1553 __reject = __v > __param._M_lf - __lfx
1554 + __x * __param._M_lp1p;
1557 __reject |= __x + __np >= __thr;
1561 __x += __np + __naf;
1563 const _IntType __z = _M_waiting(__urng, __t - _IntType(__x));
1564 __ret = _IntType(__x) + __z;
1568 __ret = _M_waiting(__urng, __t);
1571 __ret = __t - __ret;
1575 template<
typename _IntType,
1576 typename _CharT,
typename _Traits>
1578 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
1582 typedef typename __ostream_type::ios_base __ios_base;
1584 const typename __ios_base::fmtflags __flags = __os.
flags();
1585 const _CharT __fill = __os.fill();
1587 const _CharT __space = __os.widen(
' ');
1592 __os << __x.t() << __space << __x.p()
1593 << __space << __x._M_nd;
1595 __os.flags(__flags);
1597 __os.precision(__precision);
1601 template<
typename _IntType,
1602 typename _CharT,
typename _Traits>
1605 binomial_distribution<_IntType>& __x)
1608 typedef typename __istream_type::ios_base __ios_base;
1610 const typename __ios_base::fmtflags __flags = __is.
flags();
1615 __is >> __t >> __p >> __x._M_nd;
1616 __x.param(
typename binomial_distribution<_IntType>::
1617 param_type(__t, __p));
1619 __is.
flags(__flags);
1624 template<
typename _RealType,
typename _CharT,
typename _Traits>
1626 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
1630 typedef typename __ostream_type::ios_base __ios_base;
1632 const typename __ios_base::fmtflags __flags = __os.
flags();
1633 const _CharT __fill = __os.fill();
1636 __os.fill(__os.widen(
' '));
1639 __os << __x.lambda();
1641 __os.flags(__flags);
1643 __os.precision(__precision);
1647 template<
typename _RealType,
typename _CharT,
typename _Traits>
1653 typedef typename __istream_type::ios_base __ios_base;
1655 const typename __ios_base::fmtflags __flags = __is.
flags();
1661 param_type(__lambda));
1663 __is.
flags(__flags);
1674 template<
typename _RealType>
1675 template<
typename _UniformRandomNumberGenerator>
1676 typename normal_distribution<_RealType>::result_type
1679 const param_type& __param)
1682 __detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
1685 if (_M_saved_available)
1687 _M_saved_available =
false;
1697 __r2 = __x * __x + __y * __y;
1699 while (__r2 > 1.0 || __r2 == 0.0);
1702 _M_saved = __x * __mult;
1703 _M_saved_available =
true;
1704 __ret = __y * __mult;
1707 __ret = __ret * __param.stddev() + __param.mean();
1711 template<
typename _RealType>
1716 if (__d1._M_param == __d2._M_param
1717 && __d1._M_saved_available == __d2._M_saved_available)
1719 if (__d1._M_saved_available
1720 && __d1._M_saved == __d2._M_saved)
1722 else if(!__d1._M_saved_available)
1731 template<
typename _RealType,
typename _CharT,
typename _Traits>
1733 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
1734 const normal_distribution<_RealType>& __x)
1737 typedef typename __ostream_type::ios_base __ios_base;
1739 const typename __ios_base::fmtflags __flags = __os.
flags();
1740 const _CharT __fill = __os.fill();
1742 const _CharT __space = __os.widen(
' ');
1747 __os << __x.mean() << __space << __x.stddev()
1748 << __space << __x._M_saved_available;
1749 if (__x._M_saved_available)
1750 __os << __space << __x._M_saved;
1752 __os.flags(__flags);
1754 __os.precision(__precision);
1758 template<
typename _RealType,
typename _CharT,
typename _Traits>
1761 normal_distribution<_RealType>& __x)
1764 typedef typename __istream_type::ios_base __ios_base;
1766 const typename __ios_base::fmtflags __flags = __is.
flags();
1769 double __mean, __stddev;
1770 __is >> __mean >> __stddev
1771 >> __x._M_saved_available;
1772 if (__x._M_saved_available)
1773 __is >> __x._M_saved;
1774 __x.param(
typename normal_distribution<_RealType>::
1775 param_type(__mean, __stddev));
1777 __is.
flags(__flags);
1782 template<
typename _RealType,
typename _CharT,
typename _Traits>
1784 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
1785 const lognormal_distribution<_RealType>& __x)
1788 typedef typename __ostream_type::ios_base __ios_base;
1790 const typename __ios_base::fmtflags __flags = __os.
flags();
1791 const _CharT __fill = __os.fill();
1793 const _CharT __space = __os.widen(
' ');
1798 __os << __x.m() << __space << __x.s()
1799 << __space << __x._M_nd;
1801 __os.flags(__flags);
1803 __os.precision(__precision);
1807 template<
typename _RealType,
typename _CharT,
typename _Traits>
1810 lognormal_distribution<_RealType>& __x)
1813 typedef typename __istream_type::ios_base __ios_base;
1815 const typename __ios_base::fmtflags __flags = __is.
flags();
1819 __is >> __m >> __s >> __x._M_nd;
1820 __x.param(
typename lognormal_distribution<_RealType>::
1821 param_type(__m, __s));
1823 __is.
flags(__flags);
1828 template<
typename _RealType,
typename _CharT,
typename _Traits>
1830 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
1831 const chi_squared_distribution<_RealType>& __x)
1834 typedef typename __ostream_type::ios_base __ios_base;
1836 const typename __ios_base::fmtflags __flags = __os.
flags();
1837 const _CharT __fill = __os.fill();
1839 const _CharT __space = __os.widen(
' ');
1844 __os << __x.n() << __space << __x._M_gd;
1846 __os.flags(__flags);
1848 __os.precision(__precision);
1852 template<
typename _RealType,
typename _CharT,
typename _Traits>
1855 chi_squared_distribution<_RealType>& __x)
1858 typedef typename __istream_type::ios_base __ios_base;
1860 const typename __ios_base::fmtflags __flags = __is.
flags();
1864 __is >> __n >> __x._M_gd;
1865 __x.param(
typename chi_squared_distribution<_RealType>::
1868 __is.
flags(__flags);
1873 template<
typename _RealType>
1874 template<
typename _UniformRandomNumberGenerator>
1875 typename cauchy_distribution<_RealType>::result_type
1877 operator()(_UniformRandomNumberGenerator& __urng,
1878 const param_type& __p)
1880 __detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
1887 const _RealType __pi = 3.1415926535897932384626433832795029L;
1888 return __p.a() + __p.b() *
std::tan(__pi * __u);
1891 template<
typename _RealType,
typename _CharT,
typename _Traits>
1893 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
1897 typedef typename __ostream_type::ios_base __ios_base;
1899 const typename __ios_base::fmtflags __flags = __os.
flags();
1900 const _CharT __fill = __os.fill();
1902 const _CharT __space = __os.widen(
' ');
1907 __os << __x.a() << __space << __x.b();
1909 __os.flags(__flags);
1911 __os.precision(__precision);
1915 template<
typename _RealType,
typename _CharT,
typename _Traits>
1921 typedef typename __istream_type::ios_base __ios_base;
1923 const typename __ios_base::fmtflags __flags = __is.
flags();
1929 param_type(__a, __b));
1931 __is.
flags(__flags);
1936 template<
typename _RealType,
typename _CharT,
typename _Traits>
1938 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
1939 const fisher_f_distribution<_RealType>& __x)
1942 typedef typename __ostream_type::ios_base __ios_base;
1944 const typename __ios_base::fmtflags __flags = __os.
flags();
1945 const _CharT __fill = __os.fill();
1947 const _CharT __space = __os.widen(
' ');
1952 __os << __x.m() << __space << __x.n()
1953 << __space << __x._M_gd_x << __space << __x._M_gd_y;
1955 __os.flags(__flags);
1957 __os.precision(__precision);
1961 template<
typename _RealType,
typename _CharT,
typename _Traits>
1964 fisher_f_distribution<_RealType>& __x)
1967 typedef typename __istream_type::ios_base __ios_base;
1969 const typename __ios_base::fmtflags __flags = __is.
flags();
1973 __is >> __m >> __n >> __x._M_gd_x >> __x._M_gd_y;
1974 __x.param(
typename fisher_f_distribution<_RealType>::
1975 param_type(__m, __n));
1977 __is.
flags(__flags);
1982 template<
typename _RealType,
typename _CharT,
typename _Traits>
1984 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
1985 const student_t_distribution<_RealType>& __x)
1988 typedef typename __ostream_type::ios_base __ios_base;
1990 const typename __ios_base::fmtflags __flags = __os.
flags();
1991 const _CharT __fill = __os.fill();
1993 const _CharT __space = __os.widen(
' ');
1998 __os << __x.n() << __space << __x._M_nd << __space << __x._M_gd;
2000 __os.flags(__flags);
2002 __os.precision(__precision);
2006 template<
typename _RealType,
typename _CharT,
typename _Traits>
2009 student_t_distribution<_RealType>& __x)
2012 typedef typename __istream_type::ios_base __ios_base;
2014 const typename __ios_base::fmtflags __flags = __is.
flags();
2018 __is >> __n >> __x._M_nd >> __x._M_gd;
2019 __x.param(
typename student_t_distribution<_RealType>::param_type(__n));
2021 __is.
flags(__flags);
2026 template<
typename _RealType>
2028 gamma_distribution<_RealType>::param_type::
2031 _M_malpha = _M_alpha < 1.0 ? _M_alpha + _RealType(1.0) : _M_alpha;
2033 const _RealType __a1 = _M_malpha - _RealType(1.0) / _RealType(3.0);
2034 _M_a2 = _RealType(1.0) /
std::sqrt(_RealType(9.0) * __a1);
2042 template<
typename _RealType>
2043 template<
typename _UniformRandomNumberGenerator>
2044 typename gamma_distribution<_RealType>::result_type
2047 const param_type& __param)
2049 __detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
2054 - _RealType(1.0) / _RealType(3.0));
2060 __n = _M_nd(__urng);
2065 __v = __v * __v * __v;
2068 while (__u >
result_type(1.0) - 0.331 * __n * __n * __n * __n
2069 && (
std::log(__u) > (0.5 * __n * __n + __a1
2072 if (__param.alpha() == __param._M_malpha)
2073 return __a1 * __v * __param.beta();
2081 * __a1 * __v * __param.beta());
2085 template<
typename _RealType,
typename _CharT,
typename _Traits>
2087 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
2091 typedef typename __ostream_type::ios_base __ios_base;
2093 const typename __ios_base::fmtflags __flags = __os.
flags();
2094 const _CharT __fill = __os.fill();
2096 const _CharT __space = __os.widen(
' ');
2101 __os << __x.alpha() << __space << __x.beta()
2102 << __space << __x._M_nd;
2104 __os.flags(__flags);
2106 __os.precision(__precision);
2110 template<
typename _RealType,
typename _CharT,
typename _Traits>
2113 gamma_distribution<_RealType>& __x)
2116 typedef typename __istream_type::ios_base __ios_base;
2118 const typename __ios_base::fmtflags __flags = __is.
flags();
2121 _RealType __alpha_val, __beta_val;
2122 __is >> __alpha_val >> __beta_val >> __x._M_nd;
2123 __x.param(
typename gamma_distribution<_RealType>::
2124 param_type(__alpha_val, __beta_val));
2126 __is.
flags(__flags);
2131 template<
typename _RealType>
2132 template<
typename _UniformRandomNumberGenerator>
2133 typename weibull_distribution<_RealType>::result_type
2135 operator()(_UniformRandomNumberGenerator& __urng,
2136 const param_type& __p)
2138 __detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
2144 template<
typename _RealType,
typename _CharT,
typename _Traits>
2146 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
2150 typedef typename __ostream_type::ios_base __ios_base;
2152 const typename __ios_base::fmtflags __flags = __os.
flags();
2153 const _CharT __fill = __os.fill();
2155 const _CharT __space = __os.widen(
' ');
2160 __os << __x.a() << __space << __x.b();
2162 __os.flags(__flags);
2164 __os.precision(__precision);
2168 template<
typename _RealType,
typename _CharT,
typename _Traits>
2174 typedef typename __istream_type::ios_base __ios_base;
2176 const typename __ios_base::fmtflags __flags = __is.
flags();
2182 param_type(__a, __b));
2184 __is.
flags(__flags);
2189 template<
typename _RealType>
2190 template<
typename _UniformRandomNumberGenerator>
2191 typename extreme_value_distribution<_RealType>::result_type
2193 operator()(_UniformRandomNumberGenerator& __urng,
2194 const param_type& __p)
2196 __detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
2202 template<
typename _RealType,
typename _CharT,
typename _Traits>
2204 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
2208 typedef typename __ostream_type::ios_base __ios_base;
2210 const typename __ios_base::fmtflags __flags = __os.
flags();
2211 const _CharT __fill = __os.fill();
2213 const _CharT __space = __os.widen(
' ');
2218 __os << __x.a() << __space << __x.b();
2220 __os.flags(__flags);
2222 __os.precision(__precision);
2226 template<
typename _RealType,
typename _CharT,
typename _Traits>
2232 typedef typename __istream_type::ios_base __ios_base;
2234 const typename __ios_base::fmtflags __flags = __is.
flags();
2240 param_type(__a, __b));
2242 __is.
flags(__flags);
2247 template<
typename _IntType>
2249 discrete_distribution<_IntType>::param_type::
2252 if (_M_prob.size() < 2)
2259 _M_prob.end(), 0.0);
2261 __detail::__transform(_M_prob.begin(), _M_prob.end(), _M_prob.begin(),
2264 _M_cp.reserve(_M_prob.size());
2268 _M_cp[_M_cp.size() - 1] = 1.0;
2271 template<
typename _IntType>
2272 template<
typename _Func>
2273 discrete_distribution<_IntType>::param_type::
2274 param_type(
size_t __nw,
double __xmin,
double __xmax, _Func __fw)
2275 : _M_prob(), _M_cp()
2277 const size_t __n = __nw == 0 ? 1 : __nw;
2278 const double __delta = (__xmax - __xmin) / __n;
2280 _M_prob.reserve(__n);
2281 for (
size_t __k = 0; __k < __nw; ++__k)
2282 _M_prob.push_back(__fw(__xmin + __k * __delta + 0.5 * __delta));
2287 template<
typename _IntType>
2288 template<
typename _UniformRandomNumberGenerator>
2289 typename discrete_distribution<_IntType>::result_type
2290 discrete_distribution<_IntType>::
2291 operator()(_UniformRandomNumberGenerator& __urng,
2292 const param_type& __param)
2294 if (__param._M_cp.empty())
2295 return result_type(0);
2297 __detail::_Adaptor<_UniformRandomNumberGenerator, double>
2300 const double __p = __aurng();
2302 __param._M_cp.end(), __p);
2304 return __pos - __param._M_cp.begin();
2307 template<
typename _IntType,
typename _CharT,
typename _Traits>
2309 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
2310 const discrete_distribution<_IntType>& __x)
2313 typedef typename __ostream_type::ios_base __ios_base;
2315 const typename __ios_base::fmtflags __flags = __os.
flags();
2316 const _CharT __fill = __os.fill();
2318 const _CharT __space = __os.widen(
' ');
2324 __os << __prob.
size();
2325 for (
auto __dit = __prob.
begin(); __dit != __prob.
end(); ++__dit)
2326 __os << __space << *__dit;
2328 __os.flags(__flags);
2330 __os.precision(__precision);
2334 template<
typename _IntType,
typename _CharT,
typename _Traits>
2337 discrete_distribution<_IntType>& __x)
2340 typedef typename __istream_type::ios_base __ios_base;
2342 const typename __ios_base::fmtflags __flags = __is.
flags();
2350 for (; __n != 0; --__n)
2357 __x.param(
typename discrete_distribution<_IntType>::
2358 param_type(__prob_vec.
begin(), __prob_vec.
end()));
2360 __is.
flags(__flags);
2365 template<
typename _RealType>
2367 piecewise_constant_distribution<_RealType>::param_type::
2370 if (_M_int.size() < 2
2371 || (_M_int.size() == 2
2372 && _M_int[0] == _RealType(0)
2373 && _M_int[1] == _RealType(1)))
2383 __detail::__transform(_M_den.begin(), _M_den.end(), _M_den.begin(),
2386 _M_cp.reserve(_M_den.size());
2391 _M_cp[_M_cp.size() - 1] = 1.0;
2393 for (
size_t __k = 0; __k < _M_den.size(); ++__k)
2394 _M_den[__k] /= _M_int[__k + 1] - _M_int[__k];
2397 template<
typename _RealType>
2398 template<
typename _InputIteratorB,
typename _InputIteratorW>
2399 piecewise_constant_distribution<_RealType>::param_type::
2400 param_type(_InputIteratorB __bbegin,
2401 _InputIteratorB __bend,
2402 _InputIteratorW __wbegin)
2403 : _M_int(), _M_den(), _M_cp()
2405 if (__bbegin != __bend)
2409 _M_int.push_back(*__bbegin);
2411 if (__bbegin == __bend)
2414 _M_den.push_back(*__wbegin);
2422 template<
typename _RealType>
2423 template<
typename _Func>
2424 piecewise_constant_distribution<_RealType>::param_type::
2425 param_type(initializer_list<_RealType> __bl, _Func __fw)
2426 : _M_int(), _M_den(), _M_cp()
2428 _M_int.reserve(__bl.size());
2429 for (
auto __biter = __bl.begin(); __biter != __bl.end(); ++__biter)
2430 _M_int.push_back(*__biter);
2432 _M_den.reserve(_M_int.size() - 1);
2433 for (
size_t __k = 0; __k < _M_int.size() - 1; ++__k)
2434 _M_den.push_back(__fw(0.5 * (_M_int[__k + 1] + _M_int[__k])));
2439 template<
typename _RealType>
2440 template<
typename _Func>
2441 piecewise_constant_distribution<_RealType>::param_type::
2442 param_type(
size_t __nw, _RealType __xmin, _RealType __xmax, _Func __fw)
2443 : _M_int(), _M_den(), _M_cp()
2445 const size_t __n = __nw == 0 ? 1 : __nw;
2446 const _RealType __delta = (__xmax - __xmin) / __n;
2448 _M_int.reserve(__n + 1);
2449 for (
size_t __k = 0; __k <= __nw; ++__k)
2450 _M_int.push_back(__xmin + __k * __delta);
2452 _M_den.reserve(__n);
2453 for (
size_t __k = 0; __k < __nw; ++__k)
2454 _M_den.push_back(__fw(_M_int[__k] + 0.5 * __delta));
2459 template<
typename _RealType>
2460 template<
typename _UniformRandomNumberGenerator>
2461 typename piecewise_constant_distribution<_RealType>::result_type
2462 piecewise_constant_distribution<_RealType>::
2463 operator()(_UniformRandomNumberGenerator& __urng,
2464 const param_type& __param)
2466 __detail::_Adaptor<_UniformRandomNumberGenerator, double>
2469 const double __p = __aurng();
2470 if (__param._M_cp.empty())
2474 __param._M_cp.end(), __p);
2475 const size_t __i = __pos - __param._M_cp.begin();
2477 const double __pref = __i > 0 ? __param._M_cp[__i - 1] : 0.0;
2479 return __param._M_int[__i] + (__p - __pref) / __param._M_den[__i];
2482 template<
typename _RealType,
typename _CharT,
typename _Traits>
2484 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
2485 const piecewise_constant_distribution<_RealType>& __x)
2488 typedef typename __ostream_type::ios_base __ios_base;
2490 const typename __ios_base::fmtflags __flags = __os.
flags();
2491 const _CharT __fill = __os.fill();
2493 const _CharT __space = __os.widen(
' ');
2499 __os << __int.
size() - 1;
2501 for (
auto __xit = __int.
begin(); __xit != __int.
end(); ++__xit)
2502 __os << __space << *__xit;
2505 for (
auto __dit = __den.
begin(); __dit != __den.
end(); ++__dit)
2506 __os << __space << *__dit;
2508 __os.flags(__flags);
2510 __os.precision(__precision);
2514 template<
typename _RealType,
typename _CharT,
typename _Traits>
2517 piecewise_constant_distribution<_RealType>& __x)
2520 typedef typename __istream_type::ios_base __ios_base;
2522 const typename __ios_base::fmtflags __flags = __is.
flags();
2530 for (
size_t __i = 0; __i <= __n; ++__i)
2539 for (
size_t __i = 0; __i < __n; ++__i)
2546 __x.param(
typename piecewise_constant_distribution<_RealType>::
2547 param_type(__int_vec.
begin(), __int_vec.
end(), __den_vec.
begin()));
2549 __is.
flags(__flags);
2554 template<
typename _RealType>
2556 piecewise_linear_distribution<_RealType>::param_type::
2559 if (_M_int.size() < 2
2560 || (_M_int.size() == 2
2561 && _M_int[0] == _RealType(0)
2562 && _M_int[1] == _RealType(1)
2563 && _M_den[0] == _M_den[1]))
2571 _M_cp.reserve(_M_int.size() - 1);
2572 _M_m.reserve(_M_int.size() - 1);
2573 for (
size_t __k = 0; __k < _M_int.size() - 1; ++__k)
2575 const _RealType __delta = _M_int[__k + 1] - _M_int[__k];
2576 __sum += 0.5 * (_M_den[__k + 1] + _M_den[__k]) * __delta;
2577 _M_cp.push_back(__sum);
2578 _M_m.push_back((_M_den[__k + 1] - _M_den[__k]) / __delta);
2582 __detail::__transform(_M_den.begin(), _M_den.end(), _M_den.begin(),
2585 __detail::__transform(_M_cp.begin(), _M_cp.end(), _M_cp.begin(),
2588 __detail::__transform(_M_m.begin(), _M_m.end(), _M_m.begin(),
2591 _M_cp[_M_cp.size() - 1] = 1.0;
2594 template<
typename _RealType>
2595 template<
typename _InputIteratorB,
typename _InputIteratorW>
2596 piecewise_linear_distribution<_RealType>::param_type::
2597 param_type(_InputIteratorB __bbegin,
2598 _InputIteratorB __bend,
2599 _InputIteratorW __wbegin)
2600 : _M_int(), _M_den(), _M_cp(), _M_m()
2602 for (; __bbegin != __bend; ++__bbegin, ++__wbegin)
2604 _M_int.push_back(*__bbegin);
2605 _M_den.push_back(*__wbegin);
2611 template<
typename _RealType>
2612 template<
typename _Func>
2613 piecewise_linear_distribution<_RealType>::param_type::
2614 param_type(initializer_list<_RealType> __bl, _Func __fw)
2615 : _M_int(), _M_den(), _M_cp(), _M_m()
2617 _M_int.reserve(__bl.size());
2618 _M_den.reserve(__bl.size());
2619 for (
auto __biter = __bl.begin(); __biter != __bl.end(); ++__biter)
2621 _M_int.push_back(*__biter);
2622 _M_den.push_back(__fw(*__biter));
2628 template<
typename _RealType>
2629 template<
typename _Func>
2630 piecewise_linear_distribution<_RealType>::param_type::
2631 param_type(
size_t __nw, _RealType __xmin, _RealType __xmax, _Func __fw)
2632 : _M_int(), _M_den(), _M_cp(), _M_m()
2634 const size_t __n = __nw == 0 ? 1 : __nw;
2635 const _RealType __delta = (__xmax - __xmin) / __n;
2637 _M_int.reserve(__n + 1);
2638 _M_den.reserve(__n + 1);
2639 for (
size_t __k = 0; __k <= __nw; ++__k)
2641 _M_int.push_back(__xmin + __k * __delta);
2642 _M_den.push_back(__fw(_M_int[__k] + __delta));
2648 template<
typename _RealType>
2649 template<
typename _UniformRandomNumberGenerator>
2650 typename piecewise_linear_distribution<_RealType>::result_type
2651 piecewise_linear_distribution<_RealType>::
2652 operator()(_UniformRandomNumberGenerator& __urng,
2653 const param_type& __param)
2655 __detail::_Adaptor<_UniformRandomNumberGenerator, double>
2658 const double __p = __aurng();
2659 if (__param._M_cp.empty())
2663 __param._M_cp.end(), __p);
2664 const size_t __i = __pos - __param._M_cp.begin();
2666 const double __pref = __i > 0 ? __param._M_cp[__i - 1] : 0.0;
2668 const double __a = 0.5 * __param._M_m[__i];
2669 const double __b = __param._M_den[__i];
2670 const double __cm = __p - __pref;
2672 _RealType __x = __param._M_int[__i];
2677 const double __d = __b * __b + 4.0 * __a * __cm;
2678 __x += 0.5 * (
std::sqrt(__d) - __b) / __a;
2684 template<
typename _RealType,
typename _CharT,
typename _Traits>
2686 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
2687 const piecewise_linear_distribution<_RealType>& __x)
2690 typedef typename __ostream_type::ios_base __ios_base;
2692 const typename __ios_base::fmtflags __flags = __os.
flags();
2693 const _CharT __fill = __os.fill();
2695 const _CharT __space = __os.widen(
' ');
2701 __os << __int.
size() - 1;
2703 for (
auto __xit = __int.
begin(); __xit != __int.
end(); ++__xit)
2704 __os << __space << *__xit;
2707 for (
auto __dit = __den.
begin(); __dit != __den.
end(); ++__dit)
2708 __os << __space << *__dit;
2710 __os.flags(__flags);
2712 __os.precision(__precision);
2716 template<
typename _RealType,
typename _CharT,
typename _Traits>
2719 piecewise_linear_distribution<_RealType>& __x)
2722 typedef typename __istream_type::ios_base __ios_base;
2724 const typename __ios_base::fmtflags __flags = __is.
flags();
2732 for (
size_t __i = 0; __i <= __n; ++__i)
2741 for (
size_t __i = 0; __i <= __n; ++__i)
2748 __x.param(
typename piecewise_linear_distribution<_RealType>::
2749 param_type(__int_vec.
begin(), __int_vec.
end(), __den_vec.
begin()));
2751 __is.
flags(__flags);
2756 template<
typename _IntType>
2759 for (
auto __iter = __il.begin(); __iter != __il.end(); ++__iter)
2760 _M_v.push_back(__detail::__mod<result_type,
2761 __detail::_Shift<result_type, 32>::__value>(*__iter));
2764 template<
typename _InputIterator>
2765 seed_seq::seed_seq(_InputIterator __begin, _InputIterator __end)
2767 for (_InputIterator __iter = __begin; __iter != __end; ++__iter)
2768 _M_v.push_back(__detail::__mod<result_type,
2769 __detail::_Shift<result_type, 32>::__value>(*__iter));
2772 template<
typename _RandomAccessIterator>
2774 seed_seq::generate(_RandomAccessIterator __begin,
2775 _RandomAccessIterator __end)
2777 typedef typename iterator_traits<_RandomAccessIterator>::value_type
2780 if (__begin == __end)
2783 std::fill(__begin, __end, _Type(0x8b8b8b8bu));
2785 const size_t __n = __end - __begin;
2786 const size_t __s = _M_v.size();
2787 const size_t __t = (__n >= 623) ? 11
2792 const size_t __p = (__n - __t) / 2;
2793 const size_t __q = __p + __t;
2794 const size_t __m =
std::max(
size_t(__s + 1), __n);
2796 for (
size_t __k = 0; __k < __m; ++__k)
2798 _Type __arg = (__begin[__k % __n]
2799 ^ __begin[(__k + __p) % __n]
2800 ^ __begin[(__k - 1) % __n]);
2801 _Type __r1 = __arg ^ (__arg >> 27);
2802 __r1 = __detail::__mod<_Type,
2803 __detail::_Shift<_Type, 32>::__value>(1664525u * __r1);
2807 else if (__k <= __s)
2808 __r2 += __k % __n + _M_v[__k - 1];
2811 __r2 = __detail::__mod<_Type,
2812 __detail::_Shift<_Type, 32>::__value>(__r2);
2813 __begin[(__k + __p) % __n] += __r1;
2814 __begin[(__k + __q) % __n] += __r2;
2815 __begin[__k % __n] = __r2;
2818 for (
size_t __k = __m; __k < __m + __n; ++__k)
2820 _Type __arg = (__begin[__k % __n]
2821 + __begin[(__k + __p) % __n]
2822 + __begin[(__k - 1) % __n]);
2823 _Type __r3 = __arg ^ (__arg >> 27);
2824 __r3 = __detail::__mod<_Type,
2825 __detail::_Shift<_Type, 32>::__value>(1566083941u * __r3);
2826 _Type __r4 = __r3 - __k % __n;
2827 __r4 = __detail::__mod<_Type,
2828 __detail::_Shift<_Type, 32>::__value>(__r4);
2829 __begin[(__k + __p) % __n] ^= __r3;
2830 __begin[(__k + __q) % __n] ^= __r4;
2831 __begin[__k % __n] = __r4;
2835 template<
typename _RealType,
size_t __bits,
2836 typename _UniformRandomNumberGenerator>
2843 const long double __r =
static_cast<long double>(__urng.max())
2844 - static_cast<long double>(__urng.min()) + 1.0L;
2846 size_t __k = std::max<size_t>(1UL, (__b + __log2r - 1UL) / __log2r);
2847 _RealType __sum = _RealType(0);
2848 _RealType __tmp = _RealType(1);
2849 for (; __k != 0; --__k)
2851 __sum += _RealType(__urng() - __urng.min()) * __tmp;
2854 return __sum / __tmp;
2857 _GLIBCXX_END_NAMESPACE_VERSION
A discrete binomial random number distribution.
result_type operator()(_UniformRandomNumberGenerator &__urng)
Generating functions.
result_type operator()()
Gets the next value in the generated random number sequence.
A normal continuous distribution for random numbers.
ios_base & scientific(ios_base &__base)
Calls base.setf(ios_base::scientific, ios_base::floatfield).
A gamma continuous distribution for random numbers.
ios_base & skipws(ios_base &__base)
Calls base.setf(ios_base::skipws).
static constexpr _Tp max() _GLIBCXX_USE_NOEXCEPT
A Bernoulli random number distribution.
Uniform continuous distribution for random numbers.
One of the math functors.
binder2nd< _Operation > bind2nd(const _Operation &__fn, const _Tp &__x)
One of the binder functors.
result_type operator()(_UniformRandomNumberGenerator &__urng)
Generating functions.
param_type param() const
Returns the parameter set of the distribution.
param_type param() const
Returns the parameter set of the distribution.
Template class basic_ostream.This is the base class for all output streams. It provides text formatti...
Properties of fundamental types.
result_type operator()(_UniformRandomNumberGenerator &__urng)
Generating functions.
iterator end() _GLIBCXX_NOEXCEPT
_Tp accumulate(_InputIterator __first, _InputIterator __last, _Tp __init)
Accumulate values in a range.
An exponential continuous distribution for random numbers.
Define a member typedef type only if a boolean constant is true.
result_type operator()(_UniformRandomNumberGenerator &__urng)
Generating functions.
complex< _Tp > tan(const complex< _Tp > &)
Return complex tangent of z.
_Tp abs(const complex< _Tp > &)
Return magnitude of z.
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...
A extreme_value_distribution random number distribution.
result_type operator()(_UniformRandomNumberGenerator &__urng)
Generating functions.
ios_base & dec(ios_base &__base)
Calls base.setf(ios_base::dec, ios_base::basefield).
_Size __lg(_Size __n)
This is a helper function for the sort routines and for random.tcc.
void reserve(size_type __n)
Attempt to preallocate enough memory for specified number of elements.
param_type param() const
Returns the parameter set of the distribution.
void seed(result_type __s=default_seed)
Reseeds the linear_congruential_engine random number generator engine sequence to the seed __s...
param_type param() const
Returns the parameter set of the distribution.
static constexpr _Tp epsilon() _GLIBCXX_USE_NOEXCEPT
A cauchy_distribution random number distribution.
A discrete Poisson random number distribution.
ios_base & fixed(ios_base &__base)
Calls base.setf(ios_base::fixed, ios_base::floatfield).
complex< _Tp > exp(const complex< _Tp > &)
Return complex base e exponential of z.
A discrete geometric random number distribution.
size_type size() const _GLIBCXX_NOEXCEPT
param_type param() const
Returns the parameter set of the distribution.
complex< _Tp > log(const complex< _Tp > &)
Return complex natural logarithm of z.
_RealType generate_canonical(_UniformRandomNumberGenerator &__g)
A function template for converting the output of a (integral) uniform random number generator to a fl...
const _Tp & min(const _Tp &, const _Tp &)
This does what you think it does.
Produces random numbers by combining random numbers from some base engine to produce random numbers w...
param_type param() const
Returns the parameter set of the distribution.
ptrdiff_t streamsize
Integral type for I/O operation counts and buffer sizes.
Template class basic_istream.This is the base class for all input streams. It provides text formattin...
result_type operator()(_UniformRandomNumberGenerator &__urng)
Generating functions.
fmtflags flags() const
Access to format flags.
complex< _Tp > sqrt(const complex< _Tp > &)
Return complex square root of z.
result_type operator()(_UniformRandomNumberGenerator &__urng)
Generating functions.
_OutputIterator partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __result)
Return list of partial sums.
result_type operator()(_UniformRandomNumberGenerator &__urng)
Generating functions.
void clear(iostate __state=goodbit)
[Re]sets the error state.
iterator begin() _GLIBCXX_NOEXCEPT
Uniform discrete distribution for random numbers. A discrete random distribution on the range with e...
complex< _Tp > pow(const complex< _Tp > &, const _Tp &)
Return x to the y'th power.
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...
A weibull_distribution random number distribution.
bitset< _Nb > operator>>(size_t __position) const _GLIBCXX_NOEXCEPT
Self-explanatory.
A model of a linear congruential random number generator.
const _Tp & max(const _Tp &, const _Tp &)
This does what you think it does.
ios_base & left(ios_base &__base)
Calls base.setf(ios_base::left, ios_base::adjustfield).
void push_back(const value_type &__x)
Add data to the end of the vector.
back_insert_iterator< _Container > back_inserter(_Container &__x)
_ForwardIterator lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp &__val)
Finds the first position in which val could be inserted without changing the ordering.
result_type operator()()
Gets the next value in the generated random number sequence.
static constexpr _Tp min() _GLIBCXX_USE_NOEXCEPT
result_type operator()(_UniformRandomNumberGenerator &__urng)
Generating functions.
param_type param() const
Returns the parameter set of the distribution.
_RandomNumberEngine::result_type result_type
result_type operator()(_UniformRandomNumberGenerator &__urng)
Generating functions.