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;
406 template<
typename _UIntType,
size_t __w,
407 size_t __n,
size_t __m,
size_t __r,
408 _UIntType __a,
size_t __u, _UIntType __d,
size_t __s,
409 _UIntType __b,
size_t __t, _UIntType __c,
size_t __l,
412 mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
413 __s, __b, __t, __c, __l, __f>::result_type
414 mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d,
415 __s, __b, __t, __c, __l, __f>::
419 if (_M_p >= state_size)
421 const _UIntType __upper_mask = (~_UIntType()) << __r;
422 const _UIntType __lower_mask = ~__upper_mask;
424 for (
size_t __k = 0; __k < (__n - __m); ++__k)
426 _UIntType __y = ((_M_x[__k] & __upper_mask)
427 | (_M_x[__k + 1] & __lower_mask));
428 _M_x[__k] = (_M_x[__k + __m] ^ (__y >> 1)
429 ^ ((__y & 0x01) ? __a : 0));
432 for (
size_t __k = (__n - __m); __k < (__n - 1); ++__k)
434 _UIntType __y = ((_M_x[__k] & __upper_mask)
435 | (_M_x[__k + 1] & __lower_mask));
436 _M_x[__k] = (_M_x[__k + (__m - __n)] ^ (__y >> 1)
437 ^ ((__y & 0x01) ? __a : 0));
440 _UIntType __y = ((_M_x[__n - 1] & __upper_mask)
441 | (_M_x[0] & __lower_mask));
442 _M_x[__n - 1] = (_M_x[__m - 1] ^ (__y >> 1)
443 ^ ((__y & 0x01) ? __a : 0));
448 result_type __z = _M_x[_M_p++];
449 __z ^= (__z >> __u) & __d;
450 __z ^= (__z << __s) & __b;
451 __z ^= (__z << __t) & __c;
457 template<
typename _UIntType,
size_t __w,
458 size_t __n,
size_t __m,
size_t __r,
459 _UIntType __a,
size_t __u, _UIntType __d,
size_t __s,
460 _UIntType __b,
size_t __t, _UIntType __c,
size_t __l,
461 _UIntType __f,
typename _CharT,
typename _Traits>
463 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
464 const mersenne_twister_engine<_UIntType, __w, __n, __m,
465 __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>& __x)
468 typedef typename __ostream_type::ios_base __ios_base;
470 const typename __ios_base::fmtflags __flags = __os.
flags();
471 const _CharT __fill = __os.fill();
472 const _CharT __space = __os.widen(
' ');
476 for (
size_t __i = 0; __i < __n; ++__i)
477 __os << __x._M_x[__i] << __space;
485 template<
typename _UIntType,
size_t __w,
486 size_t __n,
size_t __m,
size_t __r,
487 _UIntType __a,
size_t __u, _UIntType __d,
size_t __s,
488 _UIntType __b,
size_t __t, _UIntType __c,
size_t __l,
489 _UIntType __f,
typename _CharT,
typename _Traits>
492 mersenne_twister_engine<_UIntType, __w, __n, __m,
493 __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>& __x)
496 typedef typename __istream_type::ios_base __ios_base;
498 const typename __ios_base::fmtflags __flags = __is.
flags();
501 for (
size_t __i = 0; __i < __n; ++__i)
502 __is >> __x._M_x[__i];
510 template<
typename _UIntType,
size_t __w,
size_t __s,
size_t __r>
512 subtract_with_carry_engine<_UIntType, __w, __s, __r>::word_size;
514 template<
typename _UIntType,
size_t __w,
size_t __s,
size_t __r>
516 subtract_with_carry_engine<_UIntType, __w, __s, __r>::short_lag;
518 template<
typename _UIntType,
size_t __w,
size_t __s,
size_t __r>
520 subtract_with_carry_engine<_UIntType, __w, __s, __r>::long_lag;
522 template<
typename _UIntType,
size_t __w,
size_t __s,
size_t __r>
524 subtract_with_carry_engine<_UIntType, __w, __s, __r>::default_seed;
526 template<
typename _UIntType,
size_t __w,
size_t __s,
size_t __r>
528 subtract_with_carry_engine<_UIntType, __w, __s, __r>::
529 seed(result_type __value)
532 __lcg(__value == 0u ? default_seed : __value);
534 const size_t __n = (__w + 31) / 32;
536 for (
size_t __i = 0; __i < long_lag; ++__i)
538 _UIntType __sum = 0u;
539 _UIntType __factor = 1u;
540 for (
size_t __j = 0; __j < __n; ++__j)
542 __sum += __detail::__mod<uint_least32_t,
543 __detail::_Shift<uint_least32_t, 32>::__value>
544 (__lcg()) * __factor;
545 __factor *= __detail::_Shift<_UIntType, 32>::__value;
547 _M_x[__i] = __detail::__mod<_UIntType,
548 __detail::_Shift<_UIntType, __w>::__value>(__sum);
550 _M_carry = (_M_x[long_lag - 1] == 0) ? 1 : 0;
554 template<
typename _UIntType,
size_t __w,
size_t __s,
size_t __r>
555 template<
typename _Sseq>
557 subtract_with_carry_engine<_UIntType, __w, __s, __r>::
560 const size_t __k = (__w + 31) / 32;
561 uint_least32_t __arr[__r * __k];
562 __q.generate(__arr + 0, __arr + __r * __k);
564 for (
size_t __i = 0; __i < long_lag; ++__i)
566 _UIntType __sum = 0u;
567 _UIntType __factor = 1u;
568 for (
size_t __j = 0; __j < __k; ++__j)
570 __sum += __arr[__k * __i + __j] * __factor;
571 __factor *= __detail::_Shift<_UIntType, 32>::__value;
573 _M_x[__i] = __detail::__mod<_UIntType,
574 __detail::_Shift<_UIntType, __w>::__value>(__sum);
576 _M_carry = (_M_x[long_lag - 1] == 0) ? 1 : 0;
580 template<
typename _UIntType,
size_t __w,
size_t __s,
size_t __r>
581 typename subtract_with_carry_engine<_UIntType, __w, __s, __r>::
583 subtract_with_carry_engine<_UIntType, __w, __s, __r>::
587 long __ps = _M_p - short_lag;
595 if (_M_x[__ps] >= _M_x[_M_p] + _M_carry)
597 __xi = _M_x[__ps] - _M_x[_M_p] - _M_carry;
602 __xi = (__detail::_Shift<_UIntType, __w>::__value
603 - _M_x[_M_p] - _M_carry + _M_x[__ps]);
609 if (++_M_p >= long_lag)
615 template<
typename _UIntType,
size_t __w,
size_t __s,
size_t __r,
616 typename _CharT,
typename _Traits>
618 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
619 const subtract_with_carry_engine<_UIntType,
623 typedef typename __ostream_type::ios_base __ios_base;
625 const typename __ios_base::fmtflags __flags = __os.
flags();
626 const _CharT __fill = __os.fill();
627 const _CharT __space = __os.widen(
' ');
631 for (
size_t __i = 0; __i < __r; ++__i)
632 __os << __x._M_x[__i] << __space;
633 __os << __x._M_carry << __space << __x._M_p;
640 template<
typename _UIntType,
size_t __w,
size_t __s,
size_t __r,
641 typename _CharT,
typename _Traits>
644 subtract_with_carry_engine<_UIntType, __w, __s, __r>& __x)
647 typedef typename __istream_type::ios_base __ios_base;
649 const typename __ios_base::fmtflags __flags = __is.
flags();
652 for (
size_t __i = 0; __i < __r; ++__i)
653 __is >> __x._M_x[__i];
654 __is >> __x._M_carry;
662 template<
typename _RandomNumberEngine,
size_t __p,
size_t __r>
664 discard_block_engine<_RandomNumberEngine, __p, __r>::block_size;
666 template<
typename _RandomNumberEngine,
size_t __p,
size_t __r>
668 discard_block_engine<_RandomNumberEngine, __p, __r>::used_block;
670 template<
typename _RandomNumberEngine,
size_t __p,
size_t __r>
671 typename discard_block_engine<_RandomNumberEngine,
672 __p, __r>::result_type
676 if (_M_n >= used_block)
678 _M_b.discard(block_size - _M_n);
685 template<
typename _RandomNumberEngine,
size_t __p,
size_t __r,
686 typename _CharT,
typename _Traits>
688 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
693 typedef typename __ostream_type::ios_base __ios_base;
695 const typename __ios_base::fmtflags __flags = __os.
flags();
696 const _CharT __fill = __os.fill();
697 const _CharT __space = __os.widen(
' ');
701 __os << __x.base() << __space << __x._M_n;
708 template<
typename _RandomNumberEngine,
size_t __p,
size_t __r,
709 typename _CharT,
typename _Traits>
712 discard_block_engine<_RandomNumberEngine, __p, __r>& __x)
715 typedef typename __istream_type::ios_base __ios_base;
717 const typename __ios_base::fmtflags __flags = __is.
flags();
720 __is >> __x._M_b >> __x._M_n;
727 template<
typename _RandomNumberEngine,
size_t __w,
typename _UIntType>
728 typename independent_bits_engine<_RandomNumberEngine, __w, _UIntType>::
733 typedef typename _RandomNumberEngine::result_type _Eresult_type;
734 const _Eresult_type __r
736 ? _M_b.max() - _M_b.min() + 1 : 0);
738 const unsigned __m = __r ?
std::__lg(__r) : __edig;
745 __ctype __s0, __s1, __y0, __y1;
747 for (
size_t __i = 0; __i < 2; ++__i)
749 __n = (__w + __m - 1) / __m + __i;
750 __n0 = __n - __w % __n;
751 const unsigned __w0 = __w / __n;
757 __s0 = __ctype(1) << __w0;
765 __y0 = __s0 * (__r / __s0);
767 __y1 = __s1 * (__r / __s1);
769 if (__r - __y0 <= __y0 / __n)
777 for (
size_t __k = 0; __k < __n0; ++__k)
781 __u = _M_b() - _M_b.
min();
782 while (__y0 && __u >= __y0);
783 __sum = __s0 * __sum + (__s0 ? __u % __s0 : __u);
785 for (
size_t __k = __n0; __k < __n; ++__k)
789 __u = _M_b() - _M_b.min();
790 while (__y1 && __u >= __y1);
791 __sum = __s1 * __sum + (__s1 ? __u % __s1 : __u);
797 template<
typename _RandomNumberEngine,
size_t __k>
801 template<
typename _RandomNumberEngine,
size_t __k>
806 size_t __j = __k * ((_M_y - _M_b.min())
807 / (_M_b.max() - _M_b.min() + 1.0L));
814 template<
typename _RandomNumberEngine,
size_t __k,
815 typename _CharT,
typename _Traits>
817 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
821 typedef typename __ostream_type::ios_base __ios_base;
823 const typename __ios_base::fmtflags __flags = __os.
flags();
824 const _CharT __fill = __os.fill();
825 const _CharT __space = __os.widen(
' ');
830 for (
size_t __i = 0; __i < __k; ++__i)
831 __os << __space << __x._M_v[__i];
832 __os << __space << __x._M_y;
839 template<
typename _RandomNumberEngine,
size_t __k,
840 typename _CharT,
typename _Traits>
843 shuffle_order_engine<_RandomNumberEngine, __k>& __x)
846 typedef typename __istream_type::ios_base __ios_base;
848 const typename __ios_base::fmtflags __flags = __is.
flags();
852 for (
size_t __i = 0; __i < __k; ++__i)
853 __is >> __x._M_v[__i];
861 template<
typename _IntType>
862 template<
typename _UniformRandomNumberGenerator>
863 typename uniform_int_distribution<_IntType>::result_type
865 operator()(_UniformRandomNumberGenerator& __urng,
866 const param_type& __param)
868 typedef typename _UniformRandomNumberGenerator::result_type
870 typedef typename std::make_unsigned<result_type>::type __utype;
874 const __uctype __urngmin = __urng.min();
875 const __uctype __urngmax = __urng.max();
876 const __uctype __urngrange = __urngmax - __urngmin;
877 const __uctype __urange
878 = __uctype(__param.b()) - __uctype(__param.a());
882 if (__urngrange > __urange)
885 const __uctype __uerange = __urange + 1;
886 const __uctype __scaling = __urngrange / __uerange;
887 const __uctype __past = __uerange * __scaling;
889 __ret = __uctype(__urng()) - __urngmin;
890 while (__ret >= __past);
893 else if (__urngrange < __urange)
913 const __uctype __uerngrange = __urngrange + 1;
914 __tmp = (__uerngrange * operator()
915 (__urng, param_type(0, __urange / __uerngrange)));
916 __ret = __tmp + (__uctype(__urng()) - __urngmin);
918 while (__ret > __urange || __ret < __tmp);
921 __ret = __uctype(__urng()) - __urngmin;
923 return __ret + __param.a();
926 template<
typename _IntType,
typename _CharT,
typename _Traits>
928 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
932 typedef typename __ostream_type::ios_base __ios_base;
934 const typename __ios_base::fmtflags __flags = __os.
flags();
935 const _CharT __fill = __os.fill();
936 const _CharT __space = __os.widen(
' ');
940 __os << __x.a() << __space << __x.b();
947 template<
typename _IntType,
typename _CharT,
typename _Traits>
953 typedef typename __istream_type::ios_base __ios_base;
955 const typename __ios_base::fmtflags __flags = __is.
flags();
961 param_type(__a, __b));
968 template<
typename _RealType,
typename _CharT,
typename _Traits>
970 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
974 typedef typename __ostream_type::ios_base __ios_base;
976 const typename __ios_base::fmtflags __flags = __os.
flags();
977 const _CharT __fill = __os.fill();
979 const _CharT __space = __os.widen(
' ');
984 __os << __x.a() << __space << __x.b();
988 __os.precision(__precision);
992 template<
typename _RealType,
typename _CharT,
typename _Traits>
998 typedef typename __istream_type::ios_base __ios_base;
1000 const typename __ios_base::fmtflags __flags = __is.
flags();
1006 param_type(__a, __b));
1008 __is.
flags(__flags);
1013 template<
typename _CharT,
typename _Traits>
1015 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
1019 typedef typename __ostream_type::ios_base __ios_base;
1021 const typename __ios_base::fmtflags __flags = __os.
flags();
1022 const _CharT __fill = __os.fill();
1025 __os.fill(__os.widen(
' '));
1030 __os.flags(__flags);
1032 __os.precision(__precision);
1037 template<
typename _IntType>
1038 template<
typename _UniformRandomNumberGenerator>
1039 typename geometric_distribution<_IntType>::result_type
1041 operator()(_UniformRandomNumberGenerator& __urng,
1042 const param_type& __param)
1046 const double __naf =
1049 const double __thr =
1051 __detail::_Adaptor<_UniformRandomNumberGenerator, double>
1056 __cand = std::floor(
std::log(__aurng()) / __param._M_log_1_p);
1057 while (__cand >= __thr);
1059 return result_type(__cand + __naf);
1062 template<
typename _IntType,
1063 typename _CharT,
typename _Traits>
1065 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
1069 typedef typename __ostream_type::ios_base __ios_base;
1071 const typename __ios_base::fmtflags __flags = __os.
flags();
1072 const _CharT __fill = __os.fill();
1075 __os.fill(__os.widen(
' '));
1080 __os.flags(__flags);
1082 __os.precision(__precision);
1086 template<
typename _IntType,
1087 typename _CharT,
typename _Traits>
1093 typedef typename __istream_type::ios_base __ios_base;
1095 const typename __ios_base::fmtflags __flags = __is.
flags();
1102 __is.
flags(__flags);
1107 template<
typename _IntType>
1108 template<
typename _UniformRandomNumberGenerator>
1109 typename negative_binomial_distribution<_IntType>::result_type
1111 operator()(_UniformRandomNumberGenerator& __urng)
1113 const double __y = _M_gd(__urng);
1117 return __poisson(__urng);
1120 template<
typename _IntType>
1121 template<
typename _UniformRandomNumberGenerator>
1122 typename negative_binomial_distribution<_IntType>::result_type
1124 operator()(_UniformRandomNumberGenerator& __urng,
1125 const param_type& __p)
1131 _M_gd(__urng, param_type(__p.k(), (1.0 - __p.p()) / __p.p()));
1134 return __poisson(__urng);
1137 template<
typename _IntType,
typename _CharT,
typename _Traits>
1139 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
1140 const negative_binomial_distribution<_IntType>& __x)
1143 typedef typename __ostream_type::ios_base __ios_base;
1145 const typename __ios_base::fmtflags __flags = __os.
flags();
1146 const _CharT __fill = __os.fill();
1148 const _CharT __space = __os.widen(
' ');
1150 __os.fill(__os.widen(
' '));
1153 __os << __x.k() << __space << __x.p()
1154 << __space << __x._M_gd;
1156 __os.flags(__flags);
1158 __os.precision(__precision);
1162 template<
typename _IntType,
typename _CharT,
typename _Traits>
1165 negative_binomial_distribution<_IntType>& __x)
1168 typedef typename __istream_type::ios_base __ios_base;
1170 const typename __ios_base::fmtflags __flags = __is.
flags();
1175 __is >> __k >> __p >> __x._M_gd;
1176 __x.param(
typename negative_binomial_distribution<_IntType>::
1177 param_type(__k, __p));
1179 __is.
flags(__flags);
1184 template<
typename _IntType>
1186 poisson_distribution<_IntType>::param_type::
1189 #if _GLIBCXX_USE_C99_MATH_TR1
1192 const double __m = std::floor(_M_mean);
1194 _M_lfm = std::lgamma(__m + 1);
1197 const double __pi_4 = 0.7853981633974483096156608458198757L;
1201 const double __cx = 2 * __m + _M_d;
1206 _M_cb = 2 * __cx *
std::exp(-_M_d * _M_1cx * (1 + _M_d / 2))
1224 template<
typename _IntType>
1225 template<
typename _UniformRandomNumberGenerator>
1226 typename poisson_distribution<_IntType>::result_type
1229 const param_type& __param)
1231 __detail::_Adaptor<_UniformRandomNumberGenerator, double>
1233 #if _GLIBCXX_USE_C99_MATH_TR1
1234 if (__param.mean() >= 12)
1239 const double __naf =
1241 const double __thr =
1244 const double __m = std::floor(__param.mean());
1246 const double __spi_2 = 1.2533141373155002512078826424055226L;
1247 const double __c1 = __param._M_sm * __spi_2;
1248 const double __c2 = __param._M_c2b + __c1;
1249 const double __c3 = __c2 + 1;
1250 const double __c4 = __c3 + 1;
1252 const double __e178 = 1.0129030479320018583185514777512983L;
1253 const double __c5 = __c4 + __e178;
1254 const double __c = __param._M_cb + __c5;
1255 const double __2cx = 2 * (2 * __m + __param._M_d);
1257 bool __reject =
true;
1260 const double __u = __c * __aurng();
1261 const double __e = -
std::log(__aurng());
1267 const double __n = _M_nd(__urng);
1268 const double __y = -
std::abs(__n) * __param._M_sm - 1;
1269 __x = std::floor(__y);
1270 __w = -__n * __n / 2;
1274 else if (__u <= __c2)
1276 const double __n = _M_nd(__urng);
1277 const double __y = 1 +
std::abs(__n) * __param._M_scx;
1278 __x = std::ceil(__y);
1279 __w = __y * (2 - __y) * __param._M_1cx;
1280 if (__x > __param._M_d)
1283 else if (__u <= __c3)
1287 else if (__u <= __c4)
1289 else if (__u <= __c5)
1293 const double __v = -
std::log(__aurng());
1294 const double __y = __param._M_d
1295 + __v * __2cx / __param._M_d;
1296 __x = std::ceil(__y);
1297 __w = -__param._M_d * __param._M_1cx * (1 + __y / 2);
1300 __reject = (__w - __e - __x * __param._M_lm_thr
1301 > __param._M_lfm - std::lgamma(__x + __m + 1));
1303 __reject |= __x + __m >= __thr;
1313 double __prod = 1.0;
1317 __prod *= __aurng();
1320 while (__prod > __param._M_lm_thr);
1326 template<
typename _IntType,
1327 typename _CharT,
typename _Traits>
1329 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
1333 typedef typename __ostream_type::ios_base __ios_base;
1335 const typename __ios_base::fmtflags __flags = __os.
flags();
1336 const _CharT __fill = __os.fill();
1338 const _CharT __space = __os.widen(
' ');
1343 __os << __x.mean() << __space << __x._M_nd;
1345 __os.flags(__flags);
1347 __os.precision(__precision);
1351 template<
typename _IntType,
1352 typename _CharT,
typename _Traits>
1355 poisson_distribution<_IntType>& __x)
1358 typedef typename __istream_type::ios_base __ios_base;
1360 const typename __ios_base::fmtflags __flags = __is.
flags();
1364 __is >> __mean >> __x._M_nd;
1365 __x.param(
typename poisson_distribution<_IntType>::param_type(__mean));
1367 __is.
flags(__flags);
1372 template<
typename _IntType>
1374 binomial_distribution<_IntType>::param_type::
1377 const double __p12 = _M_p <= 0.5 ? _M_p : 1.0 - _M_p;
1381 #if _GLIBCXX_USE_C99_MATH_TR1
1382 if (_M_t * __p12 >= 8)
1385 const double __np = std::floor(_M_t * __p12);
1386 const double __pa = __np / _M_t;
1387 const double __1p = 1 - __pa;
1389 const double __pi_4 = 0.7853981633974483096156608458198757L;
1390 const double __d1x =
1392 / (81 * __pi_4 * __1p)));
1393 _M_d1 = std::round(
std::max(1.0, __d1x));
1394 const double __d2x =
1396 / (__pi_4 * __pa)));
1397 _M_d2 = std::round(
std::max(1.0, __d2x));
1400 const double __spi_2 = 1.2533141373155002512078826424055226L;
1401 _M_s1 =
std::sqrt(__np * __1p) * (1 + _M_d1 / (4 * __np));
1402 _M_s2 =
std::sqrt(__np * __1p) * (1 + _M_d2 / (4 * _M_t * __1p));
1403 _M_c = 2 * _M_d1 / __np;
1404 _M_a1 =
std::exp(_M_c) * _M_s1 * __spi_2;
1405 const double __a12 = _M_a1 + _M_s2 * __spi_2;
1406 const double __s1s = _M_s1 * _M_s1;
1407 _M_a123 = __a12 + (
std::exp(_M_d1 / (_M_t * __1p))
1409 *
std::exp(-_M_d1 * _M_d1 / (2 * __s1s)));
1410 const double __s2s = _M_s2 * _M_s2;
1411 _M_s = (_M_a123 + 2 * __s2s / _M_d2
1412 *
std::exp(-_M_d2 * _M_d2 / (2 * __s2s)));
1413 _M_lf = (std::lgamma(__np + 1)
1414 + std::lgamma(_M_t - __np + 1));
1417 _M_q = -
std::log(1 - (__p12 - __pa) / __1p);
1424 template<
typename _IntType>
1425 template<
typename _UniformRandomNumberGenerator>
1426 typename binomial_distribution<_IntType>::result_type
1427 binomial_distribution<_IntType>::
1428 _M_waiting(_UniformRandomNumberGenerator& __urng, _IntType __t)
1432 __detail::_Adaptor<_UniformRandomNumberGenerator, double>
1437 const double __e = -
std::log(__aurng());
1438 __sum += __e / (__t - __x);
1441 while (__sum <= _M_param._M_q);
1456 template<
typename _IntType>
1457 template<
typename _UniformRandomNumberGenerator>
1458 typename binomial_distribution<_IntType>::result_type
1461 const param_type& __param)
1464 const _IntType __t = __param.t();
1465 const double __p = __param.p();
1466 const double __p12 = __p <= 0.5 ? __p : 1.0 - __p;
1467 __detail::_Adaptor<_UniformRandomNumberGenerator, double>
1470 #if _GLIBCXX_USE_C99_MATH_TR1
1471 if (!__param._M_easy)
1476 const double __naf =
1478 const double __thr =
1481 const double __np = std::floor(__t * __p12);
1484 const double __spi_2 = 1.2533141373155002512078826424055226L;
1485 const double __a1 = __param._M_a1;
1486 const double __a12 = __a1 + __param._M_s2 * __spi_2;
1487 const double __a123 = __param._M_a123;
1488 const double __s1s = __param._M_s1 * __param._M_s1;
1489 const double __s2s = __param._M_s2 * __param._M_s2;
1494 const double __u = __param._M_s * __aurng();
1500 const double __n = _M_nd(__urng);
1501 const double __y = __param._M_s1 *
std::abs(__n);
1502 __reject = __y >= __param._M_d1;
1505 const double __e = -
std::log(__aurng());
1506 __x = std::floor(__y);
1507 __v = -__e - __n * __n / 2 + __param._M_c;
1510 else if (__u <= __a12)
1512 const double __n = _M_nd(__urng);
1513 const double __y = __param._M_s2 *
std::abs(__n);
1514 __reject = __y >= __param._M_d2;
1517 const double __e = -
std::log(__aurng());
1518 __x = std::floor(-__y);
1519 __v = -__e - __n * __n / 2;
1522 else if (__u <= __a123)
1524 const double __e1 = -
std::log(__aurng());
1525 const double __e2 = -
std::log(__aurng());
1527 const double __y = __param._M_d1
1528 + 2 * __s1s * __e1 / __param._M_d1;
1529 __x = std::floor(__y);
1530 __v = (-__e2 + __param._M_d1 * (1 / (__t - __np)
1531 -__y / (2 * __s1s)));
1536 const double __e1 = -
std::log(__aurng());
1537 const double __e2 = -
std::log(__aurng());
1539 const double __y = __param._M_d2
1540 + 2 * __s2s * __e1 / __param._M_d2;
1541 __x = std::floor(-__y);
1542 __v = -__e2 - __param._M_d2 * __y / (2 * __s2s);
1546 __reject = __reject || __x < -__np || __x > __t - __np;
1549 const double __lfx =
1550 std::lgamma(__np + __x + 1)
1551 + std::lgamma(__t - (__np + __x) + 1);
1552 __reject = __v > __param._M_lf - __lfx
1553 + __x * __param._M_lp1p;
1556 __reject |= __x + __np >= __thr;
1560 __x += __np + __naf;
1562 const _IntType __z = _M_waiting(__urng, __t - _IntType(__x));
1563 __ret = _IntType(__x) + __z;
1567 __ret = _M_waiting(__urng, __t);
1570 __ret = __t - __ret;
1574 template<
typename _IntType,
1575 typename _CharT,
typename _Traits>
1577 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
1581 typedef typename __ostream_type::ios_base __ios_base;
1583 const typename __ios_base::fmtflags __flags = __os.
flags();
1584 const _CharT __fill = __os.fill();
1586 const _CharT __space = __os.widen(
' ');
1591 __os << __x.t() << __space << __x.p()
1592 << __space << __x._M_nd;
1594 __os.flags(__flags);
1596 __os.precision(__precision);
1600 template<
typename _IntType,
1601 typename _CharT,
typename _Traits>
1604 binomial_distribution<_IntType>& __x)
1607 typedef typename __istream_type::ios_base __ios_base;
1609 const typename __ios_base::fmtflags __flags = __is.
flags();
1614 __is >> __t >> __p >> __x._M_nd;
1615 __x.param(
typename binomial_distribution<_IntType>::
1616 param_type(__t, __p));
1618 __is.
flags(__flags);
1623 template<
typename _RealType,
typename _CharT,
typename _Traits>
1625 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
1629 typedef typename __ostream_type::ios_base __ios_base;
1631 const typename __ios_base::fmtflags __flags = __os.
flags();
1632 const _CharT __fill = __os.fill();
1635 __os.fill(__os.widen(
' '));
1638 __os << __x.lambda();
1640 __os.flags(__flags);
1642 __os.precision(__precision);
1646 template<
typename _RealType,
typename _CharT,
typename _Traits>
1652 typedef typename __istream_type::ios_base __ios_base;
1654 const typename __ios_base::fmtflags __flags = __is.
flags();
1660 param_type(__lambda));
1662 __is.
flags(__flags);
1673 template<
typename _RealType>
1674 template<
typename _UniformRandomNumberGenerator>
1675 typename normal_distribution<_RealType>::result_type
1678 const param_type& __param)
1681 __detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
1684 if (_M_saved_available)
1686 _M_saved_available =
false;
1696 __r2 = __x * __x + __y * __y;
1698 while (__r2 > 1.0 || __r2 == 0.0);
1701 _M_saved = __x * __mult;
1702 _M_saved_available =
true;
1703 __ret = __y * __mult;
1706 __ret = __ret * __param.stddev() + __param.mean();
1710 template<
typename _RealType>
1715 if (__d1._M_param == __d2._M_param
1716 && __d1._M_saved_available == __d2._M_saved_available)
1718 if (__d1._M_saved_available
1719 && __d1._M_saved == __d2._M_saved)
1721 else if(!__d1._M_saved_available)
1730 template<
typename _RealType,
typename _CharT,
typename _Traits>
1732 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
1733 const normal_distribution<_RealType>& __x)
1736 typedef typename __ostream_type::ios_base __ios_base;
1738 const typename __ios_base::fmtflags __flags = __os.
flags();
1739 const _CharT __fill = __os.fill();
1741 const _CharT __space = __os.widen(
' ');
1746 __os << __x.mean() << __space << __x.stddev()
1747 << __space << __x._M_saved_available;
1748 if (__x._M_saved_available)
1749 __os << __space << __x._M_saved;
1751 __os.flags(__flags);
1753 __os.precision(__precision);
1757 template<
typename _RealType,
typename _CharT,
typename _Traits>
1760 normal_distribution<_RealType>& __x)
1763 typedef typename __istream_type::ios_base __ios_base;
1765 const typename __ios_base::fmtflags __flags = __is.
flags();
1768 double __mean, __stddev;
1769 __is >> __mean >> __stddev
1770 >> __x._M_saved_available;
1771 if (__x._M_saved_available)
1772 __is >> __x._M_saved;
1773 __x.param(
typename normal_distribution<_RealType>::
1774 param_type(__mean, __stddev));
1776 __is.
flags(__flags);
1781 template<
typename _RealType,
typename _CharT,
typename _Traits>
1783 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
1784 const lognormal_distribution<_RealType>& __x)
1787 typedef typename __ostream_type::ios_base __ios_base;
1789 const typename __ios_base::fmtflags __flags = __os.
flags();
1790 const _CharT __fill = __os.fill();
1792 const _CharT __space = __os.widen(
' ');
1797 __os << __x.m() << __space << __x.s()
1798 << __space << __x._M_nd;
1800 __os.flags(__flags);
1802 __os.precision(__precision);
1806 template<
typename _RealType,
typename _CharT,
typename _Traits>
1809 lognormal_distribution<_RealType>& __x)
1812 typedef typename __istream_type::ios_base __ios_base;
1814 const typename __ios_base::fmtflags __flags = __is.
flags();
1818 __is >> __m >> __s >> __x._M_nd;
1819 __x.param(
typename lognormal_distribution<_RealType>::
1820 param_type(__m, __s));
1822 __is.
flags(__flags);
1827 template<
typename _RealType,
typename _CharT,
typename _Traits>
1829 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
1830 const chi_squared_distribution<_RealType>& __x)
1833 typedef typename __ostream_type::ios_base __ios_base;
1835 const typename __ios_base::fmtflags __flags = __os.
flags();
1836 const _CharT __fill = __os.fill();
1838 const _CharT __space = __os.widen(
' ');
1843 __os << __x.n() << __space << __x._M_gd;
1845 __os.flags(__flags);
1847 __os.precision(__precision);
1851 template<
typename _RealType,
typename _CharT,
typename _Traits>
1854 chi_squared_distribution<_RealType>& __x)
1857 typedef typename __istream_type::ios_base __ios_base;
1859 const typename __ios_base::fmtflags __flags = __is.
flags();
1863 __is >> __n >> __x._M_gd;
1864 __x.param(
typename chi_squared_distribution<_RealType>::
1867 __is.
flags(__flags);
1872 template<
typename _RealType>
1873 template<
typename _UniformRandomNumberGenerator>
1874 typename cauchy_distribution<_RealType>::result_type
1876 operator()(_UniformRandomNumberGenerator& __urng,
1877 const param_type& __p)
1879 __detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
1886 const _RealType __pi = 3.1415926535897932384626433832795029L;
1887 return __p.a() + __p.b() *
std::tan(__pi * __u);
1890 template<
typename _RealType,
typename _CharT,
typename _Traits>
1892 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
1896 typedef typename __ostream_type::ios_base __ios_base;
1898 const typename __ios_base::fmtflags __flags = __os.
flags();
1899 const _CharT __fill = __os.fill();
1901 const _CharT __space = __os.widen(
' ');
1906 __os << __x.a() << __space << __x.b();
1908 __os.flags(__flags);
1910 __os.precision(__precision);
1914 template<
typename _RealType,
typename _CharT,
typename _Traits>
1920 typedef typename __istream_type::ios_base __ios_base;
1922 const typename __ios_base::fmtflags __flags = __is.
flags();
1928 param_type(__a, __b));
1930 __is.
flags(__flags);
1935 template<
typename _RealType,
typename _CharT,
typename _Traits>
1937 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
1938 const fisher_f_distribution<_RealType>& __x)
1941 typedef typename __ostream_type::ios_base __ios_base;
1943 const typename __ios_base::fmtflags __flags = __os.
flags();
1944 const _CharT __fill = __os.fill();
1946 const _CharT __space = __os.widen(
' ');
1951 __os << __x.m() << __space << __x.n()
1952 << __space << __x._M_gd_x << __space << __x._M_gd_y;
1954 __os.flags(__flags);
1956 __os.precision(__precision);
1960 template<
typename _RealType,
typename _CharT,
typename _Traits>
1963 fisher_f_distribution<_RealType>& __x)
1966 typedef typename __istream_type::ios_base __ios_base;
1968 const typename __ios_base::fmtflags __flags = __is.
flags();
1972 __is >> __m >> __n >> __x._M_gd_x >> __x._M_gd_y;
1973 __x.param(
typename fisher_f_distribution<_RealType>::
1974 param_type(__m, __n));
1976 __is.
flags(__flags);
1981 template<
typename _RealType,
typename _CharT,
typename _Traits>
1983 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
1984 const student_t_distribution<_RealType>& __x)
1987 typedef typename __ostream_type::ios_base __ios_base;
1989 const typename __ios_base::fmtflags __flags = __os.
flags();
1990 const _CharT __fill = __os.fill();
1992 const _CharT __space = __os.widen(
' ');
1997 __os << __x.n() << __space << __x._M_nd << __space << __x._M_gd;
1999 __os.flags(__flags);
2001 __os.precision(__precision);
2005 template<
typename _RealType,
typename _CharT,
typename _Traits>
2008 student_t_distribution<_RealType>& __x)
2011 typedef typename __istream_type::ios_base __ios_base;
2013 const typename __ios_base::fmtflags __flags = __is.
flags();
2017 __is >> __n >> __x._M_nd >> __x._M_gd;
2018 __x.param(
typename student_t_distribution<_RealType>::param_type(__n));
2020 __is.
flags(__flags);
2025 template<
typename _RealType>
2027 gamma_distribution<_RealType>::param_type::
2030 _M_malpha = _M_alpha < 1.0 ? _M_alpha + _RealType(1.0) : _M_alpha;
2032 const _RealType __a1 = _M_malpha - _RealType(1.0) / _RealType(3.0);
2033 _M_a2 = _RealType(1.0) /
std::sqrt(_RealType(9.0) * __a1);
2041 template<
typename _RealType>
2042 template<
typename _UniformRandomNumberGenerator>
2043 typename gamma_distribution<_RealType>::result_type
2046 const param_type& __param)
2048 __detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
2053 - _RealType(1.0) / _RealType(3.0));
2059 __n = _M_nd(__urng);
2064 __v = __v * __v * __v;
2067 while (__u >
result_type(1.0) - 0.331 * __n * __n * __n * __n
2068 && (
std::log(__u) > (0.5 * __n * __n + __a1
2071 if (__param.alpha() == __param._M_malpha)
2072 return __a1 * __v * __param.beta();
2080 * __a1 * __v * __param.beta());
2084 template<
typename _RealType,
typename _CharT,
typename _Traits>
2086 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
2090 typedef typename __ostream_type::ios_base __ios_base;
2092 const typename __ios_base::fmtflags __flags = __os.
flags();
2093 const _CharT __fill = __os.fill();
2095 const _CharT __space = __os.widen(
' ');
2100 __os << __x.alpha() << __space << __x.beta()
2101 << __space << __x._M_nd;
2103 __os.flags(__flags);
2105 __os.precision(__precision);
2109 template<
typename _RealType,
typename _CharT,
typename _Traits>
2112 gamma_distribution<_RealType>& __x)
2115 typedef typename __istream_type::ios_base __ios_base;
2117 const typename __ios_base::fmtflags __flags = __is.
flags();
2120 _RealType __alpha_val, __beta_val;
2121 __is >> __alpha_val >> __beta_val >> __x._M_nd;
2122 __x.param(
typename gamma_distribution<_RealType>::
2123 param_type(__alpha_val, __beta_val));
2125 __is.
flags(__flags);
2130 template<
typename _RealType>
2131 template<
typename _UniformRandomNumberGenerator>
2132 typename weibull_distribution<_RealType>::result_type
2134 operator()(_UniformRandomNumberGenerator& __urng,
2135 const param_type& __p)
2137 __detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
2143 template<
typename _RealType,
typename _CharT,
typename _Traits>
2145 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
2149 typedef typename __ostream_type::ios_base __ios_base;
2151 const typename __ios_base::fmtflags __flags = __os.
flags();
2152 const _CharT __fill = __os.fill();
2154 const _CharT __space = __os.widen(
' ');
2159 __os << __x.a() << __space << __x.b();
2161 __os.flags(__flags);
2163 __os.precision(__precision);
2167 template<
typename _RealType,
typename _CharT,
typename _Traits>
2173 typedef typename __istream_type::ios_base __ios_base;
2175 const typename __ios_base::fmtflags __flags = __is.
flags();
2181 param_type(__a, __b));
2183 __is.
flags(__flags);
2188 template<
typename _RealType>
2189 template<
typename _UniformRandomNumberGenerator>
2190 typename extreme_value_distribution<_RealType>::result_type
2192 operator()(_UniformRandomNumberGenerator& __urng,
2193 const param_type& __p)
2195 __detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
2200 template<
typename _RealType,
typename _CharT,
typename _Traits>
2202 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
2206 typedef typename __ostream_type::ios_base __ios_base;
2208 const typename __ios_base::fmtflags __flags = __os.
flags();
2209 const _CharT __fill = __os.fill();
2211 const _CharT __space = __os.widen(
' ');
2216 __os << __x.a() << __space << __x.b();
2218 __os.flags(__flags);
2220 __os.precision(__precision);
2224 template<
typename _RealType,
typename _CharT,
typename _Traits>
2230 typedef typename __istream_type::ios_base __ios_base;
2232 const typename __ios_base::fmtflags __flags = __is.
flags();
2238 param_type(__a, __b));
2240 __is.
flags(__flags);
2245 template<
typename _IntType>
2247 discrete_distribution<_IntType>::param_type::
2250 if (_M_prob.size() < 2)
2257 _M_prob.end(), 0.0);
2259 __detail::__transform(_M_prob.begin(), _M_prob.end(), _M_prob.begin(),
2262 _M_cp.reserve(_M_prob.size());
2266 _M_cp[_M_cp.size() - 1] = 1.0;
2269 template<
typename _IntType>
2270 template<
typename _Func>
2271 discrete_distribution<_IntType>::param_type::
2272 param_type(
size_t __nw,
double __xmin,
double __xmax, _Func __fw)
2273 : _M_prob(), _M_cp()
2275 const size_t __n = __nw == 0 ? 1 : __nw;
2276 const double __delta = (__xmax - __xmin) / __n;
2278 _M_prob.reserve(__n);
2279 for (
size_t __k = 0; __k < __nw; ++__k)
2280 _M_prob.push_back(__fw(__xmin + __k * __delta + 0.5 * __delta));
2285 template<
typename _IntType>
2286 template<
typename _UniformRandomNumberGenerator>
2287 typename discrete_distribution<_IntType>::result_type
2288 discrete_distribution<_IntType>::
2289 operator()(_UniformRandomNumberGenerator& __urng,
2290 const param_type& __param)
2292 if (__param._M_cp.empty())
2293 return result_type(0);
2295 __detail::_Adaptor<_UniformRandomNumberGenerator, double>
2298 const double __p = __aurng();
2300 __param._M_cp.end(), __p);
2302 return __pos - __param._M_cp.begin();
2305 template<
typename _IntType,
typename _CharT,
typename _Traits>
2307 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
2308 const discrete_distribution<_IntType>& __x)
2311 typedef typename __ostream_type::ios_base __ios_base;
2313 const typename __ios_base::fmtflags __flags = __os.
flags();
2314 const _CharT __fill = __os.fill();
2316 const _CharT __space = __os.widen(
' ');
2322 __os << __prob.
size();
2323 for (
auto __dit = __prob.
begin(); __dit != __prob.
end(); ++__dit)
2324 __os << __space << *__dit;
2326 __os.flags(__flags);
2328 __os.precision(__precision);
2332 template<
typename _IntType,
typename _CharT,
typename _Traits>
2335 discrete_distribution<_IntType>& __x)
2338 typedef typename __istream_type::ios_base __ios_base;
2340 const typename __ios_base::fmtflags __flags = __is.
flags();
2348 for (; __n != 0; --__n)
2355 __x.param(
typename discrete_distribution<_IntType>::
2356 param_type(__prob_vec.
begin(), __prob_vec.
end()));
2358 __is.
flags(__flags);
2363 template<
typename _RealType>
2365 piecewise_constant_distribution<_RealType>::param_type::
2368 if (_M_int.size() < 2
2369 || (_M_int.size() == 2
2370 && _M_int[0] == _RealType(0)
2371 && _M_int[1] == _RealType(1)))
2381 __detail::__transform(_M_den.begin(), _M_den.end(), _M_den.begin(),
2384 _M_cp.reserve(_M_den.size());
2389 _M_cp[_M_cp.size() - 1] = 1.0;
2391 for (
size_t __k = 0; __k < _M_den.size(); ++__k)
2392 _M_den[__k] /= _M_int[__k + 1] - _M_int[__k];
2395 template<
typename _RealType>
2396 template<
typename _InputIteratorB,
typename _InputIteratorW>
2397 piecewise_constant_distribution<_RealType>::param_type::
2398 param_type(_InputIteratorB __bbegin,
2399 _InputIteratorB __bend,
2400 _InputIteratorW __wbegin)
2401 : _M_int(), _M_den(), _M_cp()
2403 if (__bbegin != __bend)
2407 _M_int.push_back(*__bbegin);
2409 if (__bbegin == __bend)
2412 _M_den.push_back(*__wbegin);
2420 template<
typename _RealType>
2421 template<
typename _Func>
2422 piecewise_constant_distribution<_RealType>::param_type::
2423 param_type(initializer_list<_RealType> __bl, _Func __fw)
2424 : _M_int(), _M_den(), _M_cp()
2426 _M_int.reserve(__bl.size());
2427 for (
auto __biter = __bl.begin(); __biter != __bl.end(); ++__biter)
2428 _M_int.push_back(*__biter);
2430 _M_den.reserve(_M_int.size() - 1);
2431 for (
size_t __k = 0; __k < _M_int.size() - 1; ++__k)
2432 _M_den.push_back(__fw(0.5 * (_M_int[__k + 1] + _M_int[__k])));
2437 template<
typename _RealType>
2438 template<
typename _Func>
2439 piecewise_constant_distribution<_RealType>::param_type::
2440 param_type(
size_t __nw, _RealType __xmin, _RealType __xmax, _Func __fw)
2441 : _M_int(), _M_den(), _M_cp()
2443 const size_t __n = __nw == 0 ? 1 : __nw;
2444 const _RealType __delta = (__xmax - __xmin) / __n;
2446 _M_int.reserve(__n + 1);
2447 for (
size_t __k = 0; __k <= __nw; ++__k)
2448 _M_int.push_back(__xmin + __k * __delta);
2450 _M_den.reserve(__n);
2451 for (
size_t __k = 0; __k < __nw; ++__k)
2452 _M_den.push_back(__fw(_M_int[__k] + 0.5 * __delta));
2457 template<
typename _RealType>
2458 template<
typename _UniformRandomNumberGenerator>
2459 typename piecewise_constant_distribution<_RealType>::result_type
2460 piecewise_constant_distribution<_RealType>::
2461 operator()(_UniformRandomNumberGenerator& __urng,
2462 const param_type& __param)
2464 __detail::_Adaptor<_UniformRandomNumberGenerator, double>
2467 const double __p = __aurng();
2468 if (__param._M_cp.empty())
2472 __param._M_cp.end(), __p);
2473 const size_t __i = __pos - __param._M_cp.begin();
2475 const double __pref = __i > 0 ? __param._M_cp[__i - 1] : 0.0;
2477 return __param._M_int[__i] + (__p - __pref) / __param._M_den[__i];
2480 template<
typename _RealType,
typename _CharT,
typename _Traits>
2482 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
2483 const piecewise_constant_distribution<_RealType>& __x)
2486 typedef typename __ostream_type::ios_base __ios_base;
2488 const typename __ios_base::fmtflags __flags = __os.
flags();
2489 const _CharT __fill = __os.fill();
2491 const _CharT __space = __os.widen(
' ');
2497 __os << __int.
size() - 1;
2499 for (
auto __xit = __int.
begin(); __xit != __int.
end(); ++__xit)
2500 __os << __space << *__xit;
2503 for (
auto __dit = __den.
begin(); __dit != __den.
end(); ++__dit)
2504 __os << __space << *__dit;
2506 __os.flags(__flags);
2508 __os.precision(__precision);
2512 template<
typename _RealType,
typename _CharT,
typename _Traits>
2515 piecewise_constant_distribution<_RealType>& __x)
2518 typedef typename __istream_type::ios_base __ios_base;
2520 const typename __ios_base::fmtflags __flags = __is.
flags();
2528 for (
size_t __i = 0; __i <= __n; ++__i)
2537 for (
size_t __i = 0; __i < __n; ++__i)
2544 __x.param(
typename piecewise_constant_distribution<_RealType>::
2545 param_type(__int_vec.
begin(), __int_vec.
end(), __den_vec.
begin()));
2547 __is.
flags(__flags);
2552 template<
typename _RealType>
2554 piecewise_linear_distribution<_RealType>::param_type::
2557 if (_M_int.size() < 2
2558 || (_M_int.size() == 2
2559 && _M_int[0] == _RealType(0)
2560 && _M_int[1] == _RealType(1)
2561 && _M_den[0] == _M_den[1]))
2569 _M_cp.reserve(_M_int.size() - 1);
2570 _M_m.reserve(_M_int.size() - 1);
2571 for (
size_t __k = 0; __k < _M_int.size() - 1; ++__k)
2573 const _RealType __delta = _M_int[__k + 1] - _M_int[__k];
2574 __sum += 0.5 * (_M_den[__k + 1] + _M_den[__k]) * __delta;
2575 _M_cp.push_back(__sum);
2576 _M_m.push_back((_M_den[__k + 1] - _M_den[__k]) / __delta);
2580 __detail::__transform(_M_den.begin(), _M_den.end(), _M_den.begin(),
2583 __detail::__transform(_M_cp.begin(), _M_cp.end(), _M_cp.begin(),
2586 __detail::__transform(_M_m.begin(), _M_m.end(), _M_m.begin(),
2589 _M_cp[_M_cp.size() - 1] = 1.0;
2592 template<
typename _RealType>
2593 template<
typename _InputIteratorB,
typename _InputIteratorW>
2594 piecewise_linear_distribution<_RealType>::param_type::
2595 param_type(_InputIteratorB __bbegin,
2596 _InputIteratorB __bend,
2597 _InputIteratorW __wbegin)
2598 : _M_int(), _M_den(), _M_cp(), _M_m()
2600 for (; __bbegin != __bend; ++__bbegin, ++__wbegin)
2602 _M_int.push_back(*__bbegin);
2603 _M_den.push_back(*__wbegin);
2609 template<
typename _RealType>
2610 template<
typename _Func>
2611 piecewise_linear_distribution<_RealType>::param_type::
2612 param_type(initializer_list<_RealType> __bl, _Func __fw)
2613 : _M_int(), _M_den(), _M_cp(), _M_m()
2615 _M_int.reserve(__bl.size());
2616 _M_den.reserve(__bl.size());
2617 for (
auto __biter = __bl.begin(); __biter != __bl.end(); ++__biter)
2619 _M_int.push_back(*__biter);
2620 _M_den.push_back(__fw(*__biter));
2626 template<
typename _RealType>
2627 template<
typename _Func>
2628 piecewise_linear_distribution<_RealType>::param_type::
2629 param_type(
size_t __nw, _RealType __xmin, _RealType __xmax, _Func __fw)
2630 : _M_int(), _M_den(), _M_cp(), _M_m()
2632 const size_t __n = __nw == 0 ? 1 : __nw;
2633 const _RealType __delta = (__xmax - __xmin) / __n;
2635 _M_int.reserve(__n + 1);
2636 _M_den.reserve(__n + 1);
2637 for (
size_t __k = 0; __k <= __nw; ++__k)
2639 _M_int.push_back(__xmin + __k * __delta);
2640 _M_den.push_back(__fw(_M_int[__k] + __delta));
2646 template<
typename _RealType>
2647 template<
typename _UniformRandomNumberGenerator>
2648 typename piecewise_linear_distribution<_RealType>::result_type
2649 piecewise_linear_distribution<_RealType>::
2650 operator()(_UniformRandomNumberGenerator& __urng,
2651 const param_type& __param)
2653 __detail::_Adaptor<_UniformRandomNumberGenerator, double>
2656 const double __p = __aurng();
2657 if (__param._M_cp.empty())
2661 __param._M_cp.end(), __p);
2662 const size_t __i = __pos - __param._M_cp.begin();
2664 const double __pref = __i > 0 ? __param._M_cp[__i - 1] : 0.0;
2666 const double __a = 0.5 * __param._M_m[__i];
2667 const double __b = __param._M_den[__i];
2668 const double __cm = __p - __pref;
2670 _RealType __x = __param._M_int[__i];
2675 const double __d = __b * __b + 4.0 * __a * __cm;
2676 __x += 0.5 * (
std::sqrt(__d) - __b) / __a;
2682 template<
typename _RealType,
typename _CharT,
typename _Traits>
2684 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
2685 const piecewise_linear_distribution<_RealType>& __x)
2688 typedef typename __ostream_type::ios_base __ios_base;
2690 const typename __ios_base::fmtflags __flags = __os.
flags();
2691 const _CharT __fill = __os.fill();
2693 const _CharT __space = __os.widen(
' ');
2699 __os << __int.
size() - 1;
2701 for (
auto __xit = __int.
begin(); __xit != __int.
end(); ++__xit)
2702 __os << __space << *__xit;
2705 for (
auto __dit = __den.
begin(); __dit != __den.
end(); ++__dit)
2706 __os << __space << *__dit;
2708 __os.flags(__flags);
2710 __os.precision(__precision);
2714 template<
typename _RealType,
typename _CharT,
typename _Traits>
2717 piecewise_linear_distribution<_RealType>& __x)
2720 typedef typename __istream_type::ios_base __ios_base;
2722 const typename __ios_base::fmtflags __flags = __is.
flags();
2730 for (
size_t __i = 0; __i <= __n; ++__i)
2739 for (
size_t __i = 0; __i <= __n; ++__i)
2746 __x.param(
typename piecewise_linear_distribution<_RealType>::
2747 param_type(__int_vec.
begin(), __int_vec.
end(), __den_vec.
begin()));
2749 __is.
flags(__flags);
2754 template<
typename _IntType>
2757 for (
auto __iter = __il.begin(); __iter != __il.end(); ++__iter)
2758 _M_v.push_back(__detail::__mod<result_type,
2759 __detail::_Shift<result_type, 32>::__value>(*__iter));
2762 template<
typename _InputIterator>
2763 seed_seq::seed_seq(_InputIterator __begin, _InputIterator __end)
2765 for (_InputIterator __iter = __begin; __iter != __end; ++__iter)
2766 _M_v.push_back(__detail::__mod<result_type,
2767 __detail::_Shift<result_type, 32>::__value>(*__iter));
2770 template<
typename _RandomAccessIterator>
2772 seed_seq::generate(_RandomAccessIterator __begin,
2773 _RandomAccessIterator __end)
2775 typedef typename iterator_traits<_RandomAccessIterator>::value_type
2778 if (__begin == __end)
2781 std::fill(__begin, __end, _Type(0x8b8b8b8bu));
2783 const size_t __n = __end - __begin;
2784 const size_t __s = _M_v.size();
2785 const size_t __t = (__n >= 623) ? 11
2790 const size_t __p = (__n - __t) / 2;
2791 const size_t __q = __p + __t;
2792 const size_t __m =
std::max(
size_t(__s + 1), __n);
2794 for (
size_t __k = 0; __k < __m; ++__k)
2796 _Type __arg = (__begin[__k % __n]
2797 ^ __begin[(__k + __p) % __n]
2798 ^ __begin[(__k - 1) % __n]);
2799 _Type __r1 = __arg ^ (__arg >> 27);
2800 __r1 = __detail::__mod<_Type,
2801 __detail::_Shift<_Type, 32>::__value>(1664525u * __r1);
2805 else if (__k <= __s)
2806 __r2 += __k % __n + _M_v[__k - 1];
2809 __r2 = __detail::__mod<_Type,
2810 __detail::_Shift<_Type, 32>::__value>(__r2);
2811 __begin[(__k + __p) % __n] += __r1;
2812 __begin[(__k + __q) % __n] += __r2;
2813 __begin[__k % __n] = __r2;
2816 for (
size_t __k = __m; __k < __m + __n; ++__k)
2818 _Type __arg = (__begin[__k % __n]
2819 + __begin[(__k + __p) % __n]
2820 + __begin[(__k - 1) % __n]);
2821 _Type __r3 = __arg ^ (__arg >> 27);
2822 __r3 = __detail::__mod<_Type,
2823 __detail::_Shift<_Type, 32>::__value>(1566083941u * __r3);
2824 _Type __r4 = __r3 - __k % __n;
2825 __r4 = __detail::__mod<_Type,
2826 __detail::_Shift<_Type, 32>::__value>(__r4);
2827 __begin[(__k + __p) % __n] ^= __r3;
2828 __begin[(__k + __q) % __n] ^= __r4;
2829 __begin[__k % __n] = __r4;
2833 template<
typename _RealType,
size_t __bits,
2834 typename _UniformRandomNumberGenerator>
2841 const long double __r =
static_cast<long double>(__urng.max())
2842 - static_cast<long double>(__urng.min()) + 1.0L;
2844 size_t __k = std::max<size_t>(1UL, (__b + __log2r - 1UL) / __log2r);
2845 _RealType __sum = _RealType(0);
2846 _RealType __tmp = _RealType(1);
2847 for (; __k != 0; --__k)
2849 __sum += _RealType(__urng() - __urng.min()) * __tmp;
2852 return __sum / __tmp;
2855 _GLIBCXX_END_NAMESPACE_VERSION
bitset< _Nb > operator>>(size_t __position) const _GLIBCXX_NOEXCEPT
Self-explanatory.
complex< _Tp > tan(const complex< _Tp > &)
Return complex tangent of z.
const _Tp & max(const _Tp &, const _Tp &)
This does what you think it does.
Template class basic_ostream.This is the base class for all output streams. It provides text formatti...
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 model of a linear congruential random number generator.
Define a member typedef type only if a boolean constant is true.
_ForwardIterator lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp &__val)
Finds the first position in which val could be inserted without changing the ordering.
_Tp abs(const complex< _Tp > &)
Return magnitude of z.
Uniform discrete distribution for random numbers. A discrete random distribution on the range with e...
result_type operator()(_UniformRandomNumberGenerator &__urng)
Generating functions.
void seed(result_type __s=default_seed)
Reseeds the linear_congruential_engine random number generator engine sequence to the seed __s...
const _Tp & min(const _Tp &, const _Tp &)
This does what you think it does.
result_type operator()(_UniformRandomNumberGenerator &__urng)
Generating functions.
A weibull_distribution random number distribution.
void clear(iostate __state=goodbit)
[Re]sets the error state.
Properties of fundamental types.
Template class basic_istream.This is the base class for all input streams. It provides text formattin...
void push_back(const value_type &__x)
Add data to the end of the vector.
param_type param() const
Returns the parameter set of the distribution.
result_type operator()(_UniformRandomNumberGenerator &__urng)
Generating functions.
A extreme_value_distribution random number distribution.
ios_base & scientific(ios_base &__base)
Calls base.setf(ios_base::scientific, ios_base::floatfield).
result_type operator()()
Gets the next value in the generated random number sequence.
param_type param() const
Returns the parameter set of the distribution.
_Size __lg(_Size __n)
This is a helper function for the sort routines and for random.tcc.
A discrete binomial random number distribution.
A discrete Poisson random number distribution.
friend bool operator==(const poisson_distribution &__d1, const poisson_distribution &__d2)
Return true if two Poisson distributions have the same parameters and the sequences that would be gen...
result_type operator()(_UniformRandomNumberGenerator &__urng)
Generating functions.
ios_base & dec(ios_base &__base)
Calls base.setf(ios_base::dec, ios_base::basefield).
ios_base & left(ios_base &__base)
Calls base.setf(ios_base::left, ios_base::adjustfield).
_OutputIterator partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __result)
Return list of partial sums.
result_type operator()(_UniformRandomNumberGenerator &__urng)
Generating functions.
ios_base & skipws(ios_base &__base)
Calls base.setf(ios_base::skipws).
static constexpr _Tp min() _GLIBCXX_USE_NOEXCEPT
_RealType generate_canonical(_UniformRandomNumberGenerator &__g)
A function template for converting the output of a (integral) uniform random number generator to a fl...
result_type operator()()
Gets the next value in the generated random number sequence.
One of the math functors.
complex< _Tp > log(const complex< _Tp > &)
Return complex natural logarithm of z.
Uniform continuous distribution for random numbers.
Produces random numbers by combining random numbers from some base engine to produce random numbers w...
fmtflags flags() const
Access to format flags.
back_insert_iterator< _Container > back_inserter(_Container &__x)
param_type param() const
Returns the parameter set of the distribution.
size_type size() const _GLIBCXX_NOEXCEPT
result_type operator()(_UniformRandomNumberGenerator &__urng)
Generating functions.
A discrete geometric random number distribution.
complex< _Tp > exp(const complex< _Tp > &)
Return complex base e exponential of z.
static constexpr _Tp max() _GLIBCXX_USE_NOEXCEPT
_Tp accumulate(_InputIterator __first, _InputIterator __last, _Tp __init)
Accumulate values in a range.
param_type param() const
Returns the parameter set of the distribution.
A normal continuous distribution for random numbers.
binder2nd< _Operation > bind2nd(const _Operation &__fn, const _Tp &__x)
One of the binder functors.
An exponential continuous distribution for random numbers.
iterator end() _GLIBCXX_NOEXCEPT
param_type param() const
Returns the parameter set of the distribution.
iterator begin() _GLIBCXX_NOEXCEPT
A Bernoulli random number distribution.
complex< _Tp > sqrt(const complex< _Tp > &)
Return complex square root of z.
result_type operator()(_UniformRandomNumberGenerator &__urng)
Generating functions.
param_type param() const
Returns the parameter set of the distribution.
ios_base & fixed(ios_base &__base)
Calls base.setf(ios_base::fixed, ios_base::floatfield).
result_type operator()(_UniformRandomNumberGenerator &__urng)
Generating functions.
ptrdiff_t streamsize
Integral type for I/O operation counts and buffer sizes.
void reserve(size_type __n)
Attempt to preallocate enough memory for specified number of elements.
static constexpr _Tp epsilon() _GLIBCXX_USE_NOEXCEPT
A cauchy_distribution random number distribution.
_RandomNumberEngine::result_type result_type
param_type param() const
Returns the parameter set of the distribution.
result_type operator()(_UniformRandomNumberGenerator &__urng)
Generating functions.
A gamma continuous distribution for random numbers.
result_type operator()(_UniformRandomNumberGenerator &__urng)
Generating functions.
complex< _Tp > pow(const complex< _Tp > &, const _Tp &)
Return x to the y'th power.