13e519524SHoward Hinnant// -*- C++ -*- 2eb8650a7SLouis Dionne//===----------------------------------------------------------------------===// 33e519524SHoward Hinnant// 457b08b09SChandler Carruth// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 557b08b09SChandler Carruth// See https://llvm.org/LICENSE.txt for license information. 657b08b09SChandler Carruth// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 73e519524SHoward Hinnant// 83e519524SHoward Hinnant//===----------------------------------------------------------------------===// 93e519524SHoward Hinnant 103e519524SHoward Hinnant#ifndef _LIBCPP_RANDOM 113e519524SHoward Hinnant#define _LIBCPP_RANDOM 123e519524SHoward Hinnant 133e519524SHoward Hinnant/* 143e519524SHoward Hinnant random synopsis 153e519524SHoward Hinnant 163e519524SHoward Hinnant#include <initializer_list> 173e519524SHoward Hinnant 183e519524SHoward Hinnantnamespace std 193e519524SHoward Hinnant{ 209f4f6ac9SChristopher Di Bella// [rand.req.urng], uniform random bit generator requirements 219f4f6ac9SChristopher Di Bellatemplate<class G> 229f4f6ac9SChristopher Di Bellaconcept uniform_random_bit_generator = see below; // C++20 233e519524SHoward Hinnant 243e519524SHoward Hinnant// Engines 253e519524SHoward Hinnant 263e519524SHoward Hinnanttemplate <class UIntType, UIntType a, UIntType c, UIntType m> 273e519524SHoward Hinnantclass linear_congruential_engine 283e519524SHoward Hinnant{ 293e519524SHoward Hinnantpublic: 303e519524SHoward Hinnant // types 313e519524SHoward Hinnant typedef UIntType result_type; 323e519524SHoward Hinnant 333e519524SHoward Hinnant // engine characteristics 343e519524SHoward Hinnant static constexpr result_type multiplier = a; 353e519524SHoward Hinnant static constexpr result_type increment = c; 363e519524SHoward Hinnant static constexpr result_type modulus = m; 373e519524SHoward Hinnant static constexpr result_type min() { return c == 0u ? 1u: 0u;} 383e519524SHoward Hinnant static constexpr result_type max() { return m - 1u;} 393e519524SHoward Hinnant static constexpr result_type default_seed = 1u; 403e519524SHoward Hinnant 413e519524SHoward Hinnant // constructors and seeding functions 42a11f8b1aSMarek Kurdej explicit linear_congruential_engine(result_type s = default_seed); // before C++20 43a11f8b1aSMarek Kurdej linear_congruential_engine() : linear_congruential_engine(default_seed) {} // C++20 44a11f8b1aSMarek Kurdej explicit linear_congruential_engine(result_type s); // C++20 453e519524SHoward Hinnant template<class Sseq> explicit linear_congruential_engine(Sseq& q); 463e519524SHoward Hinnant void seed(result_type s = default_seed); 473e519524SHoward Hinnant template<class Sseq> void seed(Sseq& q); 483e519524SHoward Hinnant 493e519524SHoward Hinnant // generating functions 503e519524SHoward Hinnant result_type operator()(); 513e519524SHoward Hinnant void discard(unsigned long long z); 523e519524SHoward Hinnant}; 533e519524SHoward Hinnant 543e519524SHoward Hinnanttemplate <class UIntType, UIntType a, UIntType c, UIntType m> 553e519524SHoward Hinnantbool 563e519524SHoward Hinnantoperator==(const linear_congruential_engine<UIntType, a, c, m>& x, 573e519524SHoward Hinnant const linear_congruential_engine<UIntType, a, c, m>& y); 583e519524SHoward Hinnant 593e519524SHoward Hinnanttemplate <class UIntType, UIntType a, UIntType c, UIntType m> 603e519524SHoward Hinnantbool 613e519524SHoward Hinnantoperator!=(const linear_congruential_engine<UIntType, a, c, m>& x, 623e519524SHoward Hinnant const linear_congruential_engine<UIntType, a, c, m>& y); 633e519524SHoward Hinnant 643e519524SHoward Hinnanttemplate <class charT, class traits, 653e519524SHoward Hinnant class UIntType, UIntType a, UIntType c, UIntType m> 663e519524SHoward Hinnantbasic_ostream<charT, traits>& 673e519524SHoward Hinnantoperator<<(basic_ostream<charT, traits>& os, 683e519524SHoward Hinnant const linear_congruential_engine<UIntType, a, c, m>& x); 693e519524SHoward Hinnant 703e519524SHoward Hinnanttemplate <class charT, class traits, 713e519524SHoward Hinnant class UIntType, UIntType a, UIntType c, UIntType m> 723e519524SHoward Hinnantbasic_istream<charT, traits>& 733e519524SHoward Hinnantoperator>>(basic_istream<charT, traits>& is, 743e519524SHoward Hinnant linear_congruential_engine<UIntType, a, c, m>& x); 753e519524SHoward Hinnant 763e519524SHoward Hinnanttemplate <class UIntType, size_t w, size_t n, size_t m, size_t r, 773e519524SHoward Hinnant UIntType a, size_t u, UIntType d, size_t s, 783e519524SHoward Hinnant UIntType b, size_t t, UIntType c, size_t l, UIntType f> 793e519524SHoward Hinnantclass mersenne_twister_engine 803e519524SHoward Hinnant{ 813e519524SHoward Hinnantpublic: 823e519524SHoward Hinnant // types 833e519524SHoward Hinnant typedef UIntType result_type; 843e519524SHoward Hinnant 853e519524SHoward Hinnant // engine characteristics 863e519524SHoward Hinnant static constexpr size_t word_size = w; 873e519524SHoward Hinnant static constexpr size_t state_size = n; 883e519524SHoward Hinnant static constexpr size_t shift_size = m; 893e519524SHoward Hinnant static constexpr size_t mask_bits = r; 903e519524SHoward Hinnant static constexpr result_type xor_mask = a; 913e519524SHoward Hinnant static constexpr size_t tempering_u = u; 923e519524SHoward Hinnant static constexpr result_type tempering_d = d; 933e519524SHoward Hinnant static constexpr size_t tempering_s = s; 943e519524SHoward Hinnant static constexpr result_type tempering_b = b; 953e519524SHoward Hinnant static constexpr size_t tempering_t = t; 963e519524SHoward Hinnant static constexpr result_type tempering_c = c; 973e519524SHoward Hinnant static constexpr size_t tempering_l = l; 983e519524SHoward Hinnant static constexpr result_type initialization_multiplier = f; 993e519524SHoward Hinnant static constexpr result_type min () { return 0; } 1003e519524SHoward Hinnant static constexpr result_type max() { return 2^w - 1; } 1013e519524SHoward Hinnant static constexpr result_type default_seed = 5489u; 1023e519524SHoward Hinnant 1033e519524SHoward Hinnant // constructors and seeding functions 104a11f8b1aSMarek Kurdej explicit mersenne_twister_engine(result_type s = default_seed); // before C++20 105a11f8b1aSMarek Kurdej mersenne_twister_engine() : mersenne_twister_engine(default_seed) {} // C++20 106a11f8b1aSMarek Kurdej explicit mersenne_twister_engine(result_type s); // C++20 1073e519524SHoward Hinnant template<class Sseq> explicit mersenne_twister_engine(Sseq& q); 1083e519524SHoward Hinnant void seed(result_type value = default_seed); 1093e519524SHoward Hinnant template<class Sseq> void seed(Sseq& q); 1103e519524SHoward Hinnant 1113e519524SHoward Hinnant // generating functions 1123e519524SHoward Hinnant result_type operator()(); 1133e519524SHoward Hinnant void discard(unsigned long long z); 1143e519524SHoward Hinnant}; 1153e519524SHoward Hinnant 1163e519524SHoward Hinnanttemplate <class UIntType, size_t w, size_t n, size_t m, size_t r, 1173e519524SHoward Hinnant UIntType a, size_t u, UIntType d, size_t s, 1183e519524SHoward Hinnant UIntType b, size_t t, UIntType c, size_t l, UIntType f> 1193e519524SHoward Hinnantbool 1203e519524SHoward Hinnantoperator==( 1213e519524SHoward Hinnant const mersenne_twister_engine<UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f>& x, 1223e519524SHoward Hinnant const mersenne_twister_engine<UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f>& y); 1233e519524SHoward Hinnant 1243e519524SHoward Hinnanttemplate <class UIntType, size_t w, size_t n, size_t m, size_t r, 1253e519524SHoward Hinnant UIntType a, size_t u, UIntType d, size_t s, 1263e519524SHoward Hinnant UIntType b, size_t t, UIntType c, size_t l, UIntType f> 1273e519524SHoward Hinnantbool 1283e519524SHoward Hinnantoperator!=( 1293e519524SHoward Hinnant const mersenne_twister_engine<UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f>& x, 1303e519524SHoward Hinnant const mersenne_twister_engine<UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f>& y); 1313e519524SHoward Hinnant 1323e519524SHoward Hinnanttemplate <class charT, class traits, 1333e519524SHoward Hinnant class UIntType, size_t w, size_t n, size_t m, size_t r, 1343e519524SHoward Hinnant UIntType a, size_t u, UIntType d, size_t s, 1353e519524SHoward Hinnant UIntType b, size_t t, UIntType c, size_t l, UIntType f> 1363e519524SHoward Hinnantbasic_ostream<charT, traits>& 1373e519524SHoward Hinnantoperator<<(basic_ostream<charT, traits>& os, 1383e519524SHoward Hinnant const mersenne_twister_engine<UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f>& x); 1393e519524SHoward Hinnant 1403e519524SHoward Hinnanttemplate <class charT, class traits, 1413e519524SHoward Hinnant class UIntType, size_t w, size_t n, size_t m, size_t r, 1423e519524SHoward Hinnant UIntType a, size_t u, UIntType d, size_t s, 1433e519524SHoward Hinnant UIntType b, size_t t, UIntType c, size_t l, UIntType f> 1443e519524SHoward Hinnantbasic_istream<charT, traits>& 1453e519524SHoward Hinnantoperator>>(basic_istream<charT, traits>& is, 1463e519524SHoward Hinnant mersenne_twister_engine<UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f>& x); 1473e519524SHoward Hinnant 1483e519524SHoward Hinnanttemplate<class UIntType, size_t w, size_t s, size_t r> 1493e519524SHoward Hinnantclass subtract_with_carry_engine 1503e519524SHoward Hinnant{ 1513e519524SHoward Hinnantpublic: 1523e519524SHoward Hinnant // types 1533e519524SHoward Hinnant typedef UIntType result_type; 1543e519524SHoward Hinnant 1553e519524SHoward Hinnant // engine characteristics 1563e519524SHoward Hinnant static constexpr size_t word_size = w; 1573e519524SHoward Hinnant static constexpr size_t short_lag = s; 1583e519524SHoward Hinnant static constexpr size_t long_lag = r; 1593e519524SHoward Hinnant static constexpr result_type min() { return 0; } 1603e519524SHoward Hinnant static constexpr result_type max() { return m-1; } 1613e519524SHoward Hinnant static constexpr result_type default_seed = 19780503u; 1623e519524SHoward Hinnant 1633e519524SHoward Hinnant // constructors and seeding functions 164a11f8b1aSMarek Kurdej explicit subtract_with_carry_engine(result_type value = default_seed); // before C++20 165a11f8b1aSMarek Kurdej subtract_with_carry_engine() : subtract_with_carry_engine(default_seed) {} // C++20 166a11f8b1aSMarek Kurdej explicit subtract_with_carry_engine(result_type value); // C++20 1673e519524SHoward Hinnant template<class Sseq> explicit subtract_with_carry_engine(Sseq& q); 1683e519524SHoward Hinnant void seed(result_type value = default_seed); 1693e519524SHoward Hinnant template<class Sseq> void seed(Sseq& q); 1703e519524SHoward Hinnant 1713e519524SHoward Hinnant // generating functions 1723e519524SHoward Hinnant result_type operator()(); 1733e519524SHoward Hinnant void discard(unsigned long long z); 1743e519524SHoward Hinnant}; 1753e519524SHoward Hinnant 1763e519524SHoward Hinnanttemplate<class UIntType, size_t w, size_t s, size_t r> 1773e519524SHoward Hinnantbool 1783e519524SHoward Hinnantoperator==( 1793e519524SHoward Hinnant const subtract_with_carry_engine<UIntType, w, s, r>& x, 1803e519524SHoward Hinnant const subtract_with_carry_engine<UIntType, w, s, r>& y); 1813e519524SHoward Hinnant 1823e519524SHoward Hinnanttemplate<class UIntType, size_t w, size_t s, size_t r> 1833e519524SHoward Hinnantbool 1843e519524SHoward Hinnantoperator!=( 1853e519524SHoward Hinnant const subtract_with_carry_engine<UIntType, w, s, r>& x, 1863e519524SHoward Hinnant const subtract_with_carry_engine<UIntType, w, s, r>& y); 1873e519524SHoward Hinnant 1883e519524SHoward Hinnanttemplate <class charT, class traits, 1893e519524SHoward Hinnant class UIntType, size_t w, size_t s, size_t r> 1903e519524SHoward Hinnantbasic_ostream<charT, traits>& 1913e519524SHoward Hinnantoperator<<(basic_ostream<charT, traits>& os, 1923e519524SHoward Hinnant const subtract_with_carry_engine<UIntType, w, s, r>& x); 1933e519524SHoward Hinnant 1943e519524SHoward Hinnanttemplate <class charT, class traits, 1953e519524SHoward Hinnant class UIntType, size_t w, size_t s, size_t r> 1963e519524SHoward Hinnantbasic_istream<charT, traits>& 1973e519524SHoward Hinnantoperator>>(basic_istream<charT, traits>& is, 1983e519524SHoward Hinnant subtract_with_carry_engine<UIntType, w, s, r>& x); 1993e519524SHoward Hinnant 2003e519524SHoward Hinnanttemplate<class Engine, size_t p, size_t r> 2013e519524SHoward Hinnantclass discard_block_engine 2023e519524SHoward Hinnant{ 2033e519524SHoward Hinnantpublic: 2043e519524SHoward Hinnant // types 2053e519524SHoward Hinnant typedef typename Engine::result_type result_type; 2063e519524SHoward Hinnant 2073e519524SHoward Hinnant // engine characteristics 2083e519524SHoward Hinnant static constexpr size_t block_size = p; 2093e519524SHoward Hinnant static constexpr size_t used_block = r; 2103e519524SHoward Hinnant static constexpr result_type min() { return Engine::min(); } 2113e519524SHoward Hinnant static constexpr result_type max() { return Engine::max(); } 2123e519524SHoward Hinnant 2133e519524SHoward Hinnant // constructors and seeding functions 2143e519524SHoward Hinnant discard_block_engine(); 2153e519524SHoward Hinnant explicit discard_block_engine(const Engine& e); 2163e519524SHoward Hinnant explicit discard_block_engine(Engine&& e); 2173e519524SHoward Hinnant explicit discard_block_engine(result_type s); 2183e519524SHoward Hinnant template<class Sseq> explicit discard_block_engine(Sseq& q); 2193e519524SHoward Hinnant void seed(); 2203e519524SHoward Hinnant void seed(result_type s); 2213e519524SHoward Hinnant template<class Sseq> void seed(Sseq& q); 2223e519524SHoward Hinnant 2233e519524SHoward Hinnant // generating functions 2243e519524SHoward Hinnant result_type operator()(); 2253e519524SHoward Hinnant void discard(unsigned long long z); 2263e519524SHoward Hinnant 2273e519524SHoward Hinnant // property functions 22800586de4SHoward Hinnant const Engine& base() const noexcept; 2293e519524SHoward Hinnant}; 2303e519524SHoward Hinnant 2313e519524SHoward Hinnanttemplate<class Engine, size_t p, size_t r> 2323e519524SHoward Hinnantbool 2333e519524SHoward Hinnantoperator==( 2343e519524SHoward Hinnant const discard_block_engine<Engine, p, r>& x, 2353e519524SHoward Hinnant const discard_block_engine<Engine, p, r>& y); 2363e519524SHoward Hinnant 2373e519524SHoward Hinnanttemplate<class Engine, size_t p, size_t r> 2383e519524SHoward Hinnantbool 2393e519524SHoward Hinnantoperator!=( 2403e519524SHoward Hinnant const discard_block_engine<Engine, p, r>& x, 2413e519524SHoward Hinnant const discard_block_engine<Engine, p, r>& y); 2423e519524SHoward Hinnant 2433e519524SHoward Hinnanttemplate <class charT, class traits, 2443e519524SHoward Hinnant class Engine, size_t p, size_t r> 2453e519524SHoward Hinnantbasic_ostream<charT, traits>& 2463e519524SHoward Hinnantoperator<<(basic_ostream<charT, traits>& os, 2473e519524SHoward Hinnant const discard_block_engine<Engine, p, r>& x); 2483e519524SHoward Hinnant 2493e519524SHoward Hinnanttemplate <class charT, class traits, 2503e519524SHoward Hinnant class Engine, size_t p, size_t r> 2513e519524SHoward Hinnantbasic_istream<charT, traits>& 2523e519524SHoward Hinnantoperator>>(basic_istream<charT, traits>& is, 2533e519524SHoward Hinnant discard_block_engine<Engine, p, r>& x); 2543e519524SHoward Hinnant 2553e519524SHoward Hinnanttemplate<class Engine, size_t w, class UIntType> 2563e519524SHoward Hinnantclass independent_bits_engine 2573e519524SHoward Hinnant{ 2583e519524SHoward Hinnantpublic: 2593e519524SHoward Hinnant // types 2603e519524SHoward Hinnant typedef UIntType result_type; 2613e519524SHoward Hinnant 2623e519524SHoward Hinnant // engine characteristics 2633e519524SHoward Hinnant static constexpr result_type min() { return 0; } 2643e519524SHoward Hinnant static constexpr result_type max() { return 2^w - 1; } 2653e519524SHoward Hinnant 2663e519524SHoward Hinnant // constructors and seeding functions 2673e519524SHoward Hinnant independent_bits_engine(); 2683e519524SHoward Hinnant explicit independent_bits_engine(const Engine& e); 2693e519524SHoward Hinnant explicit independent_bits_engine(Engine&& e); 2703e519524SHoward Hinnant explicit independent_bits_engine(result_type s); 2713e519524SHoward Hinnant template<class Sseq> explicit independent_bits_engine(Sseq& q); 2723e519524SHoward Hinnant void seed(); 2733e519524SHoward Hinnant void seed(result_type s); 2743e519524SHoward Hinnant template<class Sseq> void seed(Sseq& q); 2753e519524SHoward Hinnant 2763e519524SHoward Hinnant // generating functions 2773e519524SHoward Hinnant result_type operator()(); void discard(unsigned long long z); 2783e519524SHoward Hinnant 2793e519524SHoward Hinnant // property functions 28000586de4SHoward Hinnant const Engine& base() const noexcept; 2813e519524SHoward Hinnant}; 2823e519524SHoward Hinnant 2833e519524SHoward Hinnanttemplate<class Engine, size_t w, class UIntType> 2843e519524SHoward Hinnantbool 2853e519524SHoward Hinnantoperator==( 2863e519524SHoward Hinnant const independent_bits_engine<Engine, w, UIntType>& x, 2873e519524SHoward Hinnant const independent_bits_engine<Engine, w, UIntType>& y); 2883e519524SHoward Hinnant 2893e519524SHoward Hinnanttemplate<class Engine, size_t w, class UIntType> 2903e519524SHoward Hinnantbool 2913e519524SHoward Hinnantoperator!=( 2923e519524SHoward Hinnant const independent_bits_engine<Engine, w, UIntType>& x, 2933e519524SHoward Hinnant const independent_bits_engine<Engine, w, UIntType>& y); 2943e519524SHoward Hinnant 2953e519524SHoward Hinnanttemplate <class charT, class traits, 2963e519524SHoward Hinnant class Engine, size_t w, class UIntType> 2973e519524SHoward Hinnantbasic_ostream<charT, traits>& 2983e519524SHoward Hinnantoperator<<(basic_ostream<charT, traits>& os, 2993e519524SHoward Hinnant const independent_bits_engine<Engine, w, UIntType>& x); 3003e519524SHoward Hinnant 3013e519524SHoward Hinnanttemplate <class charT, class traits, 3023e519524SHoward Hinnant class Engine, size_t w, class UIntType> 3033e519524SHoward Hinnantbasic_istream<charT, traits>& 3043e519524SHoward Hinnantoperator>>(basic_istream<charT, traits>& is, 3053e519524SHoward Hinnant independent_bits_engine<Engine, w, UIntType>& x); 3063e519524SHoward Hinnant 3073e519524SHoward Hinnanttemplate<class Engine, size_t k> 3083e519524SHoward Hinnantclass shuffle_order_engine 3093e519524SHoward Hinnant{ 3103e519524SHoward Hinnantpublic: 3113e519524SHoward Hinnant // types 3123e519524SHoward Hinnant typedef typename Engine::result_type result_type; 3133e519524SHoward Hinnant 3143e519524SHoward Hinnant // engine characteristics 3153e519524SHoward Hinnant static constexpr size_t table_size = k; 3163e519524SHoward Hinnant static constexpr result_type min() { return Engine::min; } 3173e519524SHoward Hinnant static constexpr result_type max() { return Engine::max; } 3183e519524SHoward Hinnant 3193e519524SHoward Hinnant // constructors and seeding functions 3203e519524SHoward Hinnant shuffle_order_engine(); 3213e519524SHoward Hinnant explicit shuffle_order_engine(const Engine& e); 3223e519524SHoward Hinnant explicit shuffle_order_engine(Engine&& e); 3233e519524SHoward Hinnant explicit shuffle_order_engine(result_type s); 3243e519524SHoward Hinnant template<class Sseq> explicit shuffle_order_engine(Sseq& q); 3253e519524SHoward Hinnant void seed(); 3263e519524SHoward Hinnant void seed(result_type s); 3273e519524SHoward Hinnant template<class Sseq> void seed(Sseq& q); 3283e519524SHoward Hinnant 3293e519524SHoward Hinnant // generating functions 3303e519524SHoward Hinnant result_type operator()(); 3313e519524SHoward Hinnant void discard(unsigned long long z); 3323e519524SHoward Hinnant 3333e519524SHoward Hinnant // property functions 33400586de4SHoward Hinnant const Engine& base() const noexcept; 3353e519524SHoward Hinnant}; 3363e519524SHoward Hinnant 3373e519524SHoward Hinnanttemplate<class Engine, size_t k> 3383e519524SHoward Hinnantbool 3393e519524SHoward Hinnantoperator==( 3403e519524SHoward Hinnant const shuffle_order_engine<Engine, k>& x, 3413e519524SHoward Hinnant const shuffle_order_engine<Engine, k>& y); 3423e519524SHoward Hinnant 3433e519524SHoward Hinnanttemplate<class Engine, size_t k> 3443e519524SHoward Hinnantbool 3453e519524SHoward Hinnantoperator!=( 3463e519524SHoward Hinnant const shuffle_order_engine<Engine, k>& x, 3473e519524SHoward Hinnant const shuffle_order_engine<Engine, k>& y); 3483e519524SHoward Hinnant 3493e519524SHoward Hinnanttemplate <class charT, class traits, 3503e519524SHoward Hinnant class Engine, size_t k> 3513e519524SHoward Hinnantbasic_ostream<charT, traits>& 3523e519524SHoward Hinnantoperator<<(basic_ostream<charT, traits>& os, 3533e519524SHoward Hinnant const shuffle_order_engine<Engine, k>& x); 3543e519524SHoward Hinnant 3553e519524SHoward Hinnanttemplate <class charT, class traits, 3563e519524SHoward Hinnant class Engine, size_t k> 3573e519524SHoward Hinnantbasic_istream<charT, traits>& 3583e519524SHoward Hinnantoperator>>(basic_istream<charT, traits>& is, 3593e519524SHoward Hinnant shuffle_order_engine<Engine, k>& x); 3603e519524SHoward Hinnant 3613e519524SHoward Hinnanttypedef linear_congruential_engine<uint_fast32_t, 16807, 0, 2147483647> 3623e519524SHoward Hinnant minstd_rand0; 3633e519524SHoward Hinnanttypedef linear_congruential_engine<uint_fast32_t, 48271, 0, 2147483647> 3643e519524SHoward Hinnant minstd_rand; 3653e519524SHoward Hinnanttypedef mersenne_twister_engine<uint_fast32_t, 32, 624, 397, 31, 3663e519524SHoward Hinnant 0x9908b0df, 3673e519524SHoward Hinnant 11, 0xffffffff, 3683e519524SHoward Hinnant 7, 0x9d2c5680, 3693e519524SHoward Hinnant 15, 0xefc60000, 3703e519524SHoward Hinnant 18, 1812433253> mt19937; 3713e519524SHoward Hinnanttypedef mersenne_twister_engine<uint_fast64_t, 64, 312, 156, 31, 3723e519524SHoward Hinnant 0xb5026f5aa96619e9, 3733e519524SHoward Hinnant 29, 0x5555555555555555, 3743e519524SHoward Hinnant 17, 0x71d67fffeda60000, 3753e519524SHoward Hinnant 37, 0xfff7eee000000000, 3763e519524SHoward Hinnant 43, 6364136223846793005> mt19937_64; 3773e519524SHoward Hinnanttypedef subtract_with_carry_engine<uint_fast32_t, 24, 10, 24> ranlux24_base; 3783e519524SHoward Hinnanttypedef subtract_with_carry_engine<uint_fast64_t, 48, 5, 12> ranlux48_base; 3793e519524SHoward Hinnanttypedef discard_block_engine<ranlux24_base, 223, 23> ranlux24; 3803e519524SHoward Hinnanttypedef discard_block_engine<ranlux48_base, 389, 11> ranlux48; 3813e519524SHoward Hinnanttypedef shuffle_order_engine<minstd_rand0, 256> knuth_b; 382e302eab4SHoward Hinnanttypedef minstd_rand default_random_engine; 3833e519524SHoward Hinnant 3843e519524SHoward Hinnant// Generators 3853e519524SHoward Hinnant 3863e519524SHoward Hinnantclass random_device 3873e519524SHoward Hinnant{ 3883e519524SHoward Hinnantpublic: 3893e519524SHoward Hinnant // types 3903e519524SHoward Hinnant typedef unsigned int result_type; 3913e519524SHoward Hinnant 3923e519524SHoward Hinnant // generator characteristics 3933e519524SHoward Hinnant static constexpr result_type min() { return numeric_limits<result_type>::min(); } 3943e519524SHoward Hinnant static constexpr result_type max() { return numeric_limits<result_type>::max(); } 3953e519524SHoward Hinnant 3963e519524SHoward Hinnant // constructors 397a11f8b1aSMarek Kurdej explicit random_device(const string& token = implementation-defined); // before C++20 398a11f8b1aSMarek Kurdej random_device() : random_device(implementation-defined) {} // C++20 399a11f8b1aSMarek Kurdej explicit random_device(const string& token); // C++20 4003e519524SHoward Hinnant 4013e519524SHoward Hinnant // generating functions 4023e519524SHoward Hinnant result_type operator()(); 4033e519524SHoward Hinnant 4043e519524SHoward Hinnant // property functions 40500586de4SHoward Hinnant double entropy() const noexcept; 4063e519524SHoward Hinnant 4073e519524SHoward Hinnant // no copy functions 4083e519524SHoward Hinnant random_device(const random_device& ) = delete; 4093e519524SHoward Hinnant void operator=(const random_device& ) = delete; 4103e519524SHoward Hinnant}; 4113e519524SHoward Hinnant 4123e519524SHoward Hinnant// Utilities 4133e519524SHoward Hinnant 4143e519524SHoward Hinnantclass seed_seq 4153e519524SHoward Hinnant{ 4163e519524SHoward Hinnantpublic: 4173e519524SHoward Hinnant // types 4183e519524SHoward Hinnant typedef uint_least32_t result_type; 4193e519524SHoward Hinnant 4203e519524SHoward Hinnant // constructors 4213e519524SHoward Hinnant seed_seq(); 4223e519524SHoward Hinnant template<class T> 4233e519524SHoward Hinnant seed_seq(initializer_list<T> il); 4243e519524SHoward Hinnant template<class InputIterator> 4253e519524SHoward Hinnant seed_seq(InputIterator begin, InputIterator end); 4263e519524SHoward Hinnant 4273e519524SHoward Hinnant // generating functions 4283e519524SHoward Hinnant template<class RandomAccessIterator> 4293e519524SHoward Hinnant void generate(RandomAccessIterator begin, RandomAccessIterator end); 4303e519524SHoward Hinnant 4313e519524SHoward Hinnant // property functions 4323e519524SHoward Hinnant size_t size() const; 4333e519524SHoward Hinnant template<class OutputIterator> 4343e519524SHoward Hinnant void param(OutputIterator dest) const; 4353e519524SHoward Hinnant 4363e519524SHoward Hinnant // no copy functions 4373e519524SHoward Hinnant seed_seq(const seed_seq&) = delete; 4383e519524SHoward Hinnant void operator=(const seed_seq& ) = delete; 4393e519524SHoward Hinnant}; 4403e519524SHoward Hinnant 4413e519524SHoward Hinnanttemplate<class RealType, size_t bits, class URNG> 4423e519524SHoward Hinnant RealType generate_canonical(URNG& g); 4433e519524SHoward Hinnant 4443e519524SHoward Hinnant// Distributions 4453e519524SHoward Hinnant 4463e519524SHoward Hinnanttemplate<class IntType = int> 4473e519524SHoward Hinnantclass uniform_int_distribution 4483e519524SHoward Hinnant{ 4493e519524SHoward Hinnantpublic: 4503e519524SHoward Hinnant // types 4513e519524SHoward Hinnant typedef IntType result_type; 4523e519524SHoward Hinnant 4533e519524SHoward Hinnant class param_type 4543e519524SHoward Hinnant { 4553e519524SHoward Hinnant public: 4563e519524SHoward Hinnant typedef uniform_int_distribution distribution_type; 4573e519524SHoward Hinnant 4583e519524SHoward Hinnant explicit param_type(IntType a = 0, 4593e519524SHoward Hinnant IntType b = numeric_limits<IntType>::max()); 4603e519524SHoward Hinnant 4613e519524SHoward Hinnant result_type a() const; 4623e519524SHoward Hinnant result_type b() const; 4633e519524SHoward Hinnant 4643e519524SHoward Hinnant friend bool operator==(const param_type& x, const param_type& y); 4653e519524SHoward Hinnant friend bool operator!=(const param_type& x, const param_type& y); 4663e519524SHoward Hinnant }; 4673e519524SHoward Hinnant 4683e519524SHoward Hinnant // constructors and reset functions 4693e519524SHoward Hinnant explicit uniform_int_distribution(IntType a = 0, 470a11f8b1aSMarek Kurdej IntType b = numeric_limits<IntType>::max()); // before C++20 471a11f8b1aSMarek Kurdej uniform_int_distribution() : uniform_int_distribution(0) {} // C++20 472a11f8b1aSMarek Kurdej explicit uniform_int_distribution(IntType a, 473a11f8b1aSMarek Kurdej IntType b = numeric_limits<IntType>::max()); // C++20 4743e519524SHoward Hinnant explicit uniform_int_distribution(const param_type& parm); 4753e519524SHoward Hinnant void reset(); 4763e519524SHoward Hinnant 4773e519524SHoward Hinnant // generating functions 4783e519524SHoward Hinnant template<class URNG> result_type operator()(URNG& g); 4793e519524SHoward Hinnant template<class URNG> result_type operator()(URNG& g, const param_type& parm); 4803e519524SHoward Hinnant 4813e519524SHoward Hinnant // property functions 4823e519524SHoward Hinnant result_type a() const; 4833e519524SHoward Hinnant result_type b() const; 4843e519524SHoward Hinnant 4853e519524SHoward Hinnant param_type param() const; 4863e519524SHoward Hinnant void param(const param_type& parm); 4873e519524SHoward Hinnant 4883e519524SHoward Hinnant result_type min() const; 4893e519524SHoward Hinnant result_type max() const; 4903e519524SHoward Hinnant 4913e519524SHoward Hinnant friend bool operator==(const uniform_int_distribution& x, 4923e519524SHoward Hinnant const uniform_int_distribution& y); 4933e519524SHoward Hinnant friend bool operator!=(const uniform_int_distribution& x, 4943e519524SHoward Hinnant const uniform_int_distribution& y); 4953e519524SHoward Hinnant 4963e519524SHoward Hinnant template <class charT, class traits> 4973e519524SHoward Hinnant friend 4983e519524SHoward Hinnant basic_ostream<charT, traits>& 4993e519524SHoward Hinnant operator<<(basic_ostream<charT, traits>& os, 5003e519524SHoward Hinnant const uniform_int_distribution& x); 5013e519524SHoward Hinnant 5023e519524SHoward Hinnant template <class charT, class traits> 5033e519524SHoward Hinnant friend 5043e519524SHoward Hinnant basic_istream<charT, traits>& 5053e519524SHoward Hinnant operator>>(basic_istream<charT, traits>& is, 5063e519524SHoward Hinnant uniform_int_distribution& x); 5073e519524SHoward Hinnant}; 5083e519524SHoward Hinnant 5093e519524SHoward Hinnanttemplate<class RealType = double> 5103e519524SHoward Hinnantclass uniform_real_distribution 5113e519524SHoward Hinnant{ 5123e519524SHoward Hinnantpublic: 5133e519524SHoward Hinnant // types 5143e519524SHoward Hinnant typedef RealType result_type; 5153e519524SHoward Hinnant 5163e519524SHoward Hinnant class param_type 5173e519524SHoward Hinnant { 5183e519524SHoward Hinnant public: 5193e519524SHoward Hinnant typedef uniform_real_distribution distribution_type; 5203e519524SHoward Hinnant 5213e519524SHoward Hinnant explicit param_type(RealType a = 0, 5223e519524SHoward Hinnant RealType b = 1); 5233e519524SHoward Hinnant 5243e519524SHoward Hinnant result_type a() const; 5253e519524SHoward Hinnant result_type b() const; 5263e519524SHoward Hinnant 5273e519524SHoward Hinnant friend bool operator==(const param_type& x, const param_type& y); 5283e519524SHoward Hinnant friend bool operator!=(const param_type& x, const param_type& y); 5293e519524SHoward Hinnant }; 5303e519524SHoward Hinnant 5313e519524SHoward Hinnant // constructors and reset functions 532a11f8b1aSMarek Kurdej explicit uniform_real_distribution(RealType a = 0.0, RealType b = 1.0); // before C++20 533a11f8b1aSMarek Kurdej uniform_real_distribution() : uniform_real_distribution(0.0) {} // C++20 534a11f8b1aSMarek Kurdej explicit uniform_real_distribution(RealType a, RealType b = 1.0); // C++20 5353e519524SHoward Hinnant explicit uniform_real_distribution(const param_type& parm); 5363e519524SHoward Hinnant void reset(); 5373e519524SHoward Hinnant 5383e519524SHoward Hinnant // generating functions 5393e519524SHoward Hinnant template<class URNG> result_type operator()(URNG& g); 5403e519524SHoward Hinnant template<class URNG> result_type operator()(URNG& g, const param_type& parm); 5413e519524SHoward Hinnant 5423e519524SHoward Hinnant // property functions 5433e519524SHoward Hinnant result_type a() const; 5443e519524SHoward Hinnant result_type b() const; 5453e519524SHoward Hinnant 5463e519524SHoward Hinnant param_type param() const; 5473e519524SHoward Hinnant void param(const param_type& parm); 5483e519524SHoward Hinnant 5493e519524SHoward Hinnant result_type min() const; 5503e519524SHoward Hinnant result_type max() const; 5513e519524SHoward Hinnant 5523e519524SHoward Hinnant friend bool operator==(const uniform_real_distribution& x, 5533e519524SHoward Hinnant const uniform_real_distribution& y); 5543e519524SHoward Hinnant friend bool operator!=(const uniform_real_distribution& x, 5553e519524SHoward Hinnant const uniform_real_distribution& y); 5563e519524SHoward Hinnant 5573e519524SHoward Hinnant template <class charT, class traits> 5583e519524SHoward Hinnant friend 5593e519524SHoward Hinnant basic_ostream<charT, traits>& 5603e519524SHoward Hinnant operator<<(basic_ostream<charT, traits>& os, 5613e519524SHoward Hinnant const uniform_real_distribution& x); 5623e519524SHoward Hinnant 5633e519524SHoward Hinnant template <class charT, class traits> 5643e519524SHoward Hinnant friend 5653e519524SHoward Hinnant basic_istream<charT, traits>& 5663e519524SHoward Hinnant operator>>(basic_istream<charT, traits>& is, 5673e519524SHoward Hinnant uniform_real_distribution& x); 5683e519524SHoward Hinnant}; 5693e519524SHoward Hinnant 5703e519524SHoward Hinnantclass bernoulli_distribution 5713e519524SHoward Hinnant{ 5723e519524SHoward Hinnantpublic: 5733e519524SHoward Hinnant // types 5743e519524SHoward Hinnant typedef bool result_type; 5753e519524SHoward Hinnant 5763e519524SHoward Hinnant class param_type 5773e519524SHoward Hinnant { 5783e519524SHoward Hinnant public: 5793e519524SHoward Hinnant typedef bernoulli_distribution distribution_type; 5803e519524SHoward Hinnant 5813e519524SHoward Hinnant explicit param_type(double p = 0.5); 5823e519524SHoward Hinnant 5833e519524SHoward Hinnant double p() const; 5843e519524SHoward Hinnant 5853e519524SHoward Hinnant friend bool operator==(const param_type& x, const param_type& y); 5863e519524SHoward Hinnant friend bool operator!=(const param_type& x, const param_type& y); 5873e519524SHoward Hinnant }; 5883e519524SHoward Hinnant 5893e519524SHoward Hinnant // constructors and reset functions 590a11f8b1aSMarek Kurdej explicit bernoulli_distribution(double p = 0.5); // before C++20 591a11f8b1aSMarek Kurdej bernoulli_distribution() : bernoulli_distribution(0.5) {} // C++20 592a11f8b1aSMarek Kurdej explicit bernoulli_distribution(double p); // C++20 5933e519524SHoward Hinnant explicit bernoulli_distribution(const param_type& parm); 5943e519524SHoward Hinnant void reset(); 5953e519524SHoward Hinnant 5963e519524SHoward Hinnant // generating functions 5973e519524SHoward Hinnant template<class URNG> result_type operator()(URNG& g); 5983e519524SHoward Hinnant template<class URNG> result_type operator()(URNG& g, const param_type& parm); 5993e519524SHoward Hinnant 6003e519524SHoward Hinnant // property functions 6013e519524SHoward Hinnant double p() const; 6023e519524SHoward Hinnant 6033e519524SHoward Hinnant param_type param() const; 6043e519524SHoward Hinnant void param(const param_type& parm); 6053e519524SHoward Hinnant 6063e519524SHoward Hinnant result_type min() const; 6073e519524SHoward Hinnant result_type max() const; 6083e519524SHoward Hinnant 6093e519524SHoward Hinnant friend bool operator==(const bernoulli_distribution& x, 6103e519524SHoward Hinnant const bernoulli_distribution& y); 6113e519524SHoward Hinnant friend bool operator!=(const bernoulli_distribution& x, 6123e519524SHoward Hinnant const bernoulli_distribution& y); 6133e519524SHoward Hinnant 6143e519524SHoward Hinnant template <class charT, class traits> 6153e519524SHoward Hinnant friend 6163e519524SHoward Hinnant basic_ostream<charT, traits>& 6173e519524SHoward Hinnant operator<<(basic_ostream<charT, traits>& os, 6183e519524SHoward Hinnant const bernoulli_distribution& x); 6193e519524SHoward Hinnant 6203e519524SHoward Hinnant template <class charT, class traits> 6213e519524SHoward Hinnant friend 6223e519524SHoward Hinnant basic_istream<charT, traits>& 6233e519524SHoward Hinnant operator>>(basic_istream<charT, traits>& is, 6243e519524SHoward Hinnant bernoulli_distribution& x); 6253e519524SHoward Hinnant}; 6263e519524SHoward Hinnant 6273e519524SHoward Hinnanttemplate<class IntType = int> 628deb23ecdSHoward Hinnantclass binomial_distribution 629deb23ecdSHoward Hinnant{ 630deb23ecdSHoward Hinnantpublic: 631deb23ecdSHoward Hinnant // types 632deb23ecdSHoward Hinnant typedef IntType result_type; 633deb23ecdSHoward Hinnant 634deb23ecdSHoward Hinnant class param_type 635deb23ecdSHoward Hinnant { 636deb23ecdSHoward Hinnant public: 637deb23ecdSHoward Hinnant typedef binomial_distribution distribution_type; 638deb23ecdSHoward Hinnant 639deb23ecdSHoward Hinnant explicit param_type(IntType t = 1, double p = 0.5); 640deb23ecdSHoward Hinnant 641deb23ecdSHoward Hinnant IntType t() const; 642deb23ecdSHoward Hinnant double p() const; 643deb23ecdSHoward Hinnant 644deb23ecdSHoward Hinnant friend bool operator==(const param_type& x, const param_type& y); 645deb23ecdSHoward Hinnant friend bool operator!=(const param_type& x, const param_type& y); 646deb23ecdSHoward Hinnant }; 647deb23ecdSHoward Hinnant 648deb23ecdSHoward Hinnant // constructors and reset functions 649a11f8b1aSMarek Kurdej explicit binomial_distribution(IntType t = 1, double p = 0.5); // before C++20 650a11f8b1aSMarek Kurdej binomial_distribution() : binomial_distribution(1) {} // C++20 651a11f8b1aSMarek Kurdej explicit binomial_distribution(IntType t, double p = 0.5); // C++20 652deb23ecdSHoward Hinnant explicit binomial_distribution(const param_type& parm); 653deb23ecdSHoward Hinnant void reset(); 654deb23ecdSHoward Hinnant 655deb23ecdSHoward Hinnant // generating functions 656deb23ecdSHoward Hinnant template<class URNG> result_type operator()(URNG& g); 657deb23ecdSHoward Hinnant template<class URNG> result_type operator()(URNG& g, const param_type& parm); 658deb23ecdSHoward Hinnant 659deb23ecdSHoward Hinnant // property functions 660deb23ecdSHoward Hinnant IntType t() const; 661deb23ecdSHoward Hinnant double p() const; 662deb23ecdSHoward Hinnant 663deb23ecdSHoward Hinnant param_type param() const; 664deb23ecdSHoward Hinnant void param(const param_type& parm); 665deb23ecdSHoward Hinnant 666deb23ecdSHoward Hinnant result_type min() const; 667deb23ecdSHoward Hinnant result_type max() const; 668deb23ecdSHoward Hinnant 669deb23ecdSHoward Hinnant friend bool operator==(const binomial_distribution& x, 670deb23ecdSHoward Hinnant const binomial_distribution& y); 671deb23ecdSHoward Hinnant friend bool operator!=(const binomial_distribution& x, 672deb23ecdSHoward Hinnant const binomial_distribution& y); 673deb23ecdSHoward Hinnant 674deb23ecdSHoward Hinnant template <class charT, class traits> 675deb23ecdSHoward Hinnant friend 676deb23ecdSHoward Hinnant basic_ostream<charT, traits>& 677deb23ecdSHoward Hinnant operator<<(basic_ostream<charT, traits>& os, 678deb23ecdSHoward Hinnant const binomial_distribution& x); 679deb23ecdSHoward Hinnant 680deb23ecdSHoward Hinnant template <class charT, class traits> 681deb23ecdSHoward Hinnant friend 682deb23ecdSHoward Hinnant basic_istream<charT, traits>& 683deb23ecdSHoward Hinnant operator>>(basic_istream<charT, traits>& is, 684deb23ecdSHoward Hinnant binomial_distribution& x); 685deb23ecdSHoward Hinnant}; 6863e519524SHoward Hinnant 6873e519524SHoward Hinnanttemplate<class IntType = int> 68805fa30d5SHoward Hinnantclass geometric_distribution 68905fa30d5SHoward Hinnant{ 69005fa30d5SHoward Hinnantpublic: 69105fa30d5SHoward Hinnant // types 69205fa30d5SHoward Hinnant typedef IntType result_type; 69305fa30d5SHoward Hinnant 69405fa30d5SHoward Hinnant class param_type 69505fa30d5SHoward Hinnant { 69605fa30d5SHoward Hinnant public: 69705fa30d5SHoward Hinnant typedef geometric_distribution distribution_type; 69805fa30d5SHoward Hinnant 69905fa30d5SHoward Hinnant explicit param_type(double p = 0.5); 70005fa30d5SHoward Hinnant 70105fa30d5SHoward Hinnant double p() const; 70205fa30d5SHoward Hinnant 70305fa30d5SHoward Hinnant friend bool operator==(const param_type& x, const param_type& y); 70405fa30d5SHoward Hinnant friend bool operator!=(const param_type& x, const param_type& y); 70505fa30d5SHoward Hinnant }; 70605fa30d5SHoward Hinnant 70705fa30d5SHoward Hinnant // constructors and reset functions 708a11f8b1aSMarek Kurdej explicit geometric_distribution(double p = 0.5); // before C++20 709a11f8b1aSMarek Kurdej geometric_distribution() : geometric_distribution(0.5) {} // C++20 710a11f8b1aSMarek Kurdej explicit geometric_distribution(double p); // C++20 71105fa30d5SHoward Hinnant explicit geometric_distribution(const param_type& parm); 71205fa30d5SHoward Hinnant void reset(); 71305fa30d5SHoward Hinnant 71405fa30d5SHoward Hinnant // generating functions 71505fa30d5SHoward Hinnant template<class URNG> result_type operator()(URNG& g); 71605fa30d5SHoward Hinnant template<class URNG> result_type operator()(URNG& g, const param_type& parm); 71705fa30d5SHoward Hinnant 71805fa30d5SHoward Hinnant // property functions 71905fa30d5SHoward Hinnant double p() const; 72005fa30d5SHoward Hinnant 72105fa30d5SHoward Hinnant param_type param() const; 72205fa30d5SHoward Hinnant void param(const param_type& parm); 72305fa30d5SHoward Hinnant 72405fa30d5SHoward Hinnant result_type min() const; 72505fa30d5SHoward Hinnant result_type max() const; 72605fa30d5SHoward Hinnant 72705fa30d5SHoward Hinnant friend bool operator==(const geometric_distribution& x, 72805fa30d5SHoward Hinnant const geometric_distribution& y); 72905fa30d5SHoward Hinnant friend bool operator!=(const geometric_distribution& x, 73005fa30d5SHoward Hinnant const geometric_distribution& y); 73105fa30d5SHoward Hinnant 73205fa30d5SHoward Hinnant template <class charT, class traits> 73305fa30d5SHoward Hinnant friend 73405fa30d5SHoward Hinnant basic_ostream<charT, traits>& 73505fa30d5SHoward Hinnant operator<<(basic_ostream<charT, traits>& os, 73605fa30d5SHoward Hinnant const geometric_distribution& x); 73705fa30d5SHoward Hinnant 73805fa30d5SHoward Hinnant template <class charT, class traits> 73905fa30d5SHoward Hinnant friend 74005fa30d5SHoward Hinnant basic_istream<charT, traits>& 74105fa30d5SHoward Hinnant operator>>(basic_istream<charT, traits>& is, 74205fa30d5SHoward Hinnant geometric_distribution& x); 74305fa30d5SHoward Hinnant}; 7443e519524SHoward Hinnant 7453e519524SHoward Hinnanttemplate<class IntType = int> 74689eaea24SHoward Hinnantclass negative_binomial_distribution 74789eaea24SHoward Hinnant{ 74889eaea24SHoward Hinnantpublic: 74989eaea24SHoward Hinnant // types 75089eaea24SHoward Hinnant typedef IntType result_type; 75189eaea24SHoward Hinnant 75289eaea24SHoward Hinnant class param_type 75389eaea24SHoward Hinnant { 75489eaea24SHoward Hinnant public: 75589eaea24SHoward Hinnant typedef negative_binomial_distribution distribution_type; 75689eaea24SHoward Hinnant 75789eaea24SHoward Hinnant explicit param_type(result_type k = 1, double p = 0.5); 75889eaea24SHoward Hinnant 75989eaea24SHoward Hinnant result_type k() const; 76089eaea24SHoward Hinnant double p() const; 76189eaea24SHoward Hinnant 76289eaea24SHoward Hinnant friend bool operator==(const param_type& x, const param_type& y); 76389eaea24SHoward Hinnant friend bool operator!=(const param_type& x, const param_type& y); 76489eaea24SHoward Hinnant }; 76589eaea24SHoward Hinnant 76689eaea24SHoward Hinnant // constructor and reset functions 767a11f8b1aSMarek Kurdej explicit negative_binomial_distribution(IntType k = 1, double p = 0.5); // before C++20 768a11f8b1aSMarek Kurdej negative_binomial_distribution() : negative_binomial_distribution(1) {} // C++20 769a11f8b1aSMarek Kurdej explicit negative_binomial_distribution(IntType k, double p = 0.5); // C++20 77089eaea24SHoward Hinnant explicit negative_binomial_distribution(const param_type& parm); 77189eaea24SHoward Hinnant void reset(); 77289eaea24SHoward Hinnant 77389eaea24SHoward Hinnant // generating functions 77489eaea24SHoward Hinnant template<class URNG> result_type operator()(URNG& g); 77589eaea24SHoward Hinnant template<class URNG> result_type operator()(URNG& g, const param_type& parm); 77689eaea24SHoward Hinnant 77789eaea24SHoward Hinnant // property functions 77889eaea24SHoward Hinnant result_type k() const; 77989eaea24SHoward Hinnant double p() const; 78089eaea24SHoward Hinnant 78189eaea24SHoward Hinnant param_type param() const; 78289eaea24SHoward Hinnant void param(const param_type& parm); 78389eaea24SHoward Hinnant 78489eaea24SHoward Hinnant result_type min() const; 78589eaea24SHoward Hinnant result_type max() const; 78689eaea24SHoward Hinnant 78789eaea24SHoward Hinnant friend bool operator==(const negative_binomial_distribution& x, 78889eaea24SHoward Hinnant const negative_binomial_distribution& y); 78989eaea24SHoward Hinnant friend bool operator!=(const negative_binomial_distribution& x, 79089eaea24SHoward Hinnant const negative_binomial_distribution& y); 79189eaea24SHoward Hinnant 79289eaea24SHoward Hinnant template <class charT, class traits> 79389eaea24SHoward Hinnant friend 79489eaea24SHoward Hinnant basic_ostream<charT, traits>& 79589eaea24SHoward Hinnant operator<<(basic_ostream<charT, traits>& os, 79689eaea24SHoward Hinnant const negative_binomial_distribution& x); 79789eaea24SHoward Hinnant 79889eaea24SHoward Hinnant template <class charT, class traits> 79989eaea24SHoward Hinnant friend 80089eaea24SHoward Hinnant basic_istream<charT, traits>& 80189eaea24SHoward Hinnant operator>>(basic_istream<charT, traits>& is, 80289eaea24SHoward Hinnant negative_binomial_distribution& x); 80389eaea24SHoward Hinnant}; 8043e519524SHoward Hinnant 8053e519524SHoward Hinnanttemplate<class IntType = int> 8060e675818SHoward Hinnantclass poisson_distribution 8070e675818SHoward Hinnant{ 8080e675818SHoward Hinnantpublic: 8090e675818SHoward Hinnant // types 8100e675818SHoward Hinnant typedef IntType result_type; 8110e675818SHoward Hinnant 8120e675818SHoward Hinnant class param_type 8130e675818SHoward Hinnant { 8140e675818SHoward Hinnant public: 8150e675818SHoward Hinnant typedef poisson_distribution distribution_type; 8160e675818SHoward Hinnant 8170e675818SHoward Hinnant explicit param_type(double mean = 1.0); 8180e675818SHoward Hinnant 8190e675818SHoward Hinnant double mean() const; 8200e675818SHoward Hinnant 8210e675818SHoward Hinnant friend bool operator==(const param_type& x, const param_type& y); 8220e675818SHoward Hinnant friend bool operator!=(const param_type& x, const param_type& y); 8230e675818SHoward Hinnant }; 8240e675818SHoward Hinnant 8250e675818SHoward Hinnant // constructors and reset functions 826a11f8b1aSMarek Kurdej explicit poisson_distribution(double mean = 1.0); // before C++20 827a11f8b1aSMarek Kurdej poisson_distribution() : poisson_distribution(1.0) {} // C++20 828a11f8b1aSMarek Kurdej explicit poisson_distribution(double mean); // C++20 8290e675818SHoward Hinnant explicit poisson_distribution(const param_type& parm); 8300e675818SHoward Hinnant void reset(); 8310e675818SHoward Hinnant 8320e675818SHoward Hinnant // generating functions 8330e675818SHoward Hinnant template<class URNG> result_type operator()(URNG& g); 8340e675818SHoward Hinnant template<class URNG> result_type operator()(URNG& g, const param_type& parm); 8350e675818SHoward Hinnant 8360e675818SHoward Hinnant // property functions 8370e675818SHoward Hinnant double mean() const; 8380e675818SHoward Hinnant 8390e675818SHoward Hinnant param_type param() const; 8400e675818SHoward Hinnant void param(const param_type& parm); 8410e675818SHoward Hinnant 8420e675818SHoward Hinnant result_type min() const; 8430e675818SHoward Hinnant result_type max() const; 8440e675818SHoward Hinnant 8450e675818SHoward Hinnant friend bool operator==(const poisson_distribution& x, 8460e675818SHoward Hinnant const poisson_distribution& y); 8470e675818SHoward Hinnant friend bool operator!=(const poisson_distribution& x, 8480e675818SHoward Hinnant const poisson_distribution& y); 8490e675818SHoward Hinnant 8500e675818SHoward Hinnant template <class charT, class traits> 8510e675818SHoward Hinnant friend 8520e675818SHoward Hinnant basic_ostream<charT, traits>& 8530e675818SHoward Hinnant operator<<(basic_ostream<charT, traits>& os, 8540e675818SHoward Hinnant const poisson_distribution& x); 8550e675818SHoward Hinnant 8560e675818SHoward Hinnant template <class charT, class traits> 8570e675818SHoward Hinnant friend 8580e675818SHoward Hinnant basic_istream<charT, traits>& 8590e675818SHoward Hinnant operator>>(basic_istream<charT, traits>& is, 8600e675818SHoward Hinnant poisson_distribution& x); 8610e675818SHoward Hinnant}; 8623e519524SHoward Hinnant 8633e519524SHoward Hinnanttemplate<class RealType = double> 864bcc4ff0dSHoward Hinnantclass exponential_distribution 865bcc4ff0dSHoward Hinnant{ 866bcc4ff0dSHoward Hinnantpublic: 867bcc4ff0dSHoward Hinnant // types 868bcc4ff0dSHoward Hinnant typedef RealType result_type; 869bcc4ff0dSHoward Hinnant 870bcc4ff0dSHoward Hinnant class param_type 871bcc4ff0dSHoward Hinnant { 872bcc4ff0dSHoward Hinnant public: 873bcc4ff0dSHoward Hinnant typedef exponential_distribution distribution_type; 874bcc4ff0dSHoward Hinnant 8756f97c4e7SHoward Hinnant explicit param_type(result_type lambda = 1.0); 876bcc4ff0dSHoward Hinnant 8776f97c4e7SHoward Hinnant result_type lambda() const; 878bcc4ff0dSHoward Hinnant 879bcc4ff0dSHoward Hinnant friend bool operator==(const param_type& x, const param_type& y); 880bcc4ff0dSHoward Hinnant friend bool operator!=(const param_type& x, const param_type& y); 881bcc4ff0dSHoward Hinnant }; 882bcc4ff0dSHoward Hinnant 883bcc4ff0dSHoward Hinnant // constructors and reset functions 884a11f8b1aSMarek Kurdej explicit exponential_distribution(RealType lambda = 1.0); // before C++20 885a11f8b1aSMarek Kurdej exponential_distribution() : exponential_distribution(1.0) {} // C++20 886a11f8b1aSMarek Kurdej explicit exponential_distribution(RealType lambda); // C++20 887bcc4ff0dSHoward Hinnant explicit exponential_distribution(const param_type& parm); 888bcc4ff0dSHoward Hinnant void reset(); 889bcc4ff0dSHoward Hinnant 890bcc4ff0dSHoward Hinnant // generating functions 891bcc4ff0dSHoward Hinnant template<class URNG> result_type operator()(URNG& g); 892bcc4ff0dSHoward Hinnant template<class URNG> result_type operator()(URNG& g, const param_type& parm); 893bcc4ff0dSHoward Hinnant 894bcc4ff0dSHoward Hinnant // property functions 8956f97c4e7SHoward Hinnant result_type lambda() const; 896bcc4ff0dSHoward Hinnant 897bcc4ff0dSHoward Hinnant param_type param() const; 898bcc4ff0dSHoward Hinnant void param(const param_type& parm); 899bcc4ff0dSHoward Hinnant 900bcc4ff0dSHoward Hinnant result_type min() const; 901bcc4ff0dSHoward Hinnant result_type max() const; 902bcc4ff0dSHoward Hinnant 903bcc4ff0dSHoward Hinnant friend bool operator==(const exponential_distribution& x, 904bcc4ff0dSHoward Hinnant const exponential_distribution& y); 905bcc4ff0dSHoward Hinnant friend bool operator!=(const exponential_distribution& x, 906bcc4ff0dSHoward Hinnant const exponential_distribution& y); 907bcc4ff0dSHoward Hinnant 908bcc4ff0dSHoward Hinnant template <class charT, class traits> 909bcc4ff0dSHoward Hinnant friend 910bcc4ff0dSHoward Hinnant basic_ostream<charT, traits>& 911bcc4ff0dSHoward Hinnant operator<<(basic_ostream<charT, traits>& os, 912bcc4ff0dSHoward Hinnant const exponential_distribution& x); 913bcc4ff0dSHoward Hinnant 914bcc4ff0dSHoward Hinnant template <class charT, class traits> 915bcc4ff0dSHoward Hinnant friend 916bcc4ff0dSHoward Hinnant basic_istream<charT, traits>& 917bcc4ff0dSHoward Hinnant operator>>(basic_istream<charT, traits>& is, 918bcc4ff0dSHoward Hinnant exponential_distribution& x); 919bcc4ff0dSHoward Hinnant}; 9203e519524SHoward Hinnant 9213e519524SHoward Hinnanttemplate<class RealType = double> 922f8bfb45eSHoward Hinnantclass gamma_distribution 923f8bfb45eSHoward Hinnant{ 924f8bfb45eSHoward Hinnantpublic: 925f8bfb45eSHoward Hinnant // types 926f8bfb45eSHoward Hinnant typedef RealType result_type; 927f8bfb45eSHoward Hinnant 928f8bfb45eSHoward Hinnant class param_type 929f8bfb45eSHoward Hinnant { 930f8bfb45eSHoward Hinnant public: 931f8bfb45eSHoward Hinnant typedef gamma_distribution distribution_type; 932f8bfb45eSHoward Hinnant 933f8bfb45eSHoward Hinnant explicit param_type(result_type alpha = 1, result_type beta = 1); 934f8bfb45eSHoward Hinnant 935f8bfb45eSHoward Hinnant result_type alpha() const; 936f8bfb45eSHoward Hinnant result_type beta() const; 937f8bfb45eSHoward Hinnant 938f8bfb45eSHoward Hinnant friend bool operator==(const param_type& x, const param_type& y); 939f8bfb45eSHoward Hinnant friend bool operator!=(const param_type& x, const param_type& y); 940f8bfb45eSHoward Hinnant }; 941f8bfb45eSHoward Hinnant 942f8bfb45eSHoward Hinnant // constructors and reset functions 943a11f8b1aSMarek Kurdej explicit gamma_distribution(RealType alpha = 0.0, RealType beta = 1.0); // before C++20 944a11f8b1aSMarek Kurdej gamma_distribution() : gamma_distribution(0.0) {} // C++20 945a11f8b1aSMarek Kurdej explicit gamma_distribution(RealType alpha, RealType beta = 1.0); // C++20 946f8bfb45eSHoward Hinnant explicit gamma_distribution(const param_type& parm); 947f8bfb45eSHoward Hinnant void reset(); 948f8bfb45eSHoward Hinnant 949f8bfb45eSHoward Hinnant // generating functions 950f8bfb45eSHoward Hinnant template<class URNG> result_type operator()(URNG& g); 951f8bfb45eSHoward Hinnant template<class URNG> result_type operator()(URNG& g, const param_type& parm); 952f8bfb45eSHoward Hinnant 953f8bfb45eSHoward Hinnant // property functions 954f8bfb45eSHoward Hinnant result_type alpha() const; 955f8bfb45eSHoward Hinnant result_type beta() const; 956f8bfb45eSHoward Hinnant 957f8bfb45eSHoward Hinnant param_type param() const; 958f8bfb45eSHoward Hinnant void param(const param_type& parm); 959f8bfb45eSHoward Hinnant 960f8bfb45eSHoward Hinnant result_type min() const; 961f8bfb45eSHoward Hinnant result_type max() const; 962f8bfb45eSHoward Hinnant 963f8bfb45eSHoward Hinnant friend bool operator==(const gamma_distribution& x, 964f8bfb45eSHoward Hinnant const gamma_distribution& y); 965f8bfb45eSHoward Hinnant friend bool operator!=(const gamma_distribution& x, 966f8bfb45eSHoward Hinnant const gamma_distribution& y); 967f8bfb45eSHoward Hinnant 968f8bfb45eSHoward Hinnant template <class charT, class traits> 969f8bfb45eSHoward Hinnant friend 970f8bfb45eSHoward Hinnant basic_ostream<charT, traits>& 971f8bfb45eSHoward Hinnant operator<<(basic_ostream<charT, traits>& os, 972f8bfb45eSHoward Hinnant const gamma_distribution& x); 973f8bfb45eSHoward Hinnant 974f8bfb45eSHoward Hinnant template <class charT, class traits> 975f8bfb45eSHoward Hinnant friend 976f8bfb45eSHoward Hinnant basic_istream<charT, traits>& 977f8bfb45eSHoward Hinnant operator>>(basic_istream<charT, traits>& is, 978f8bfb45eSHoward Hinnant gamma_distribution& x); 979f8bfb45eSHoward Hinnant}; 9803e519524SHoward Hinnant 9813e519524SHoward Hinnanttemplate<class RealType = double> 982b8829825SHoward Hinnantclass weibull_distribution 983b8829825SHoward Hinnant{ 984b8829825SHoward Hinnantpublic: 985b8829825SHoward Hinnant // types 986b8829825SHoward Hinnant typedef RealType result_type; 987b8829825SHoward Hinnant 988b8829825SHoward Hinnant class param_type 989b8829825SHoward Hinnant { 990b8829825SHoward Hinnant public: 991b8829825SHoward Hinnant typedef weibull_distribution distribution_type; 992b8829825SHoward Hinnant 993b8829825SHoward Hinnant explicit param_type(result_type alpha = 1, result_type beta = 1); 994b8829825SHoward Hinnant 995b8829825SHoward Hinnant result_type a() const; 996b8829825SHoward Hinnant result_type b() const; 997b8829825SHoward Hinnant 998b8829825SHoward Hinnant friend bool operator==(const param_type& x, const param_type& y); 999b8829825SHoward Hinnant friend bool operator!=(const param_type& x, const param_type& y); 1000b8829825SHoward Hinnant }; 1001b8829825SHoward Hinnant 1002b8829825SHoward Hinnant // constructor and reset functions 1003a11f8b1aSMarek Kurdej explicit weibull_distribution(RealType a = 1.0, RealType b = 1.0); // before C++20 1004a11f8b1aSMarek Kurdej weibull_distribution() : weibull_distribution(1.0) {} // C++20 1005a11f8b1aSMarek Kurdej explicit weibull_distribution(RealType a, RealType b = 1.0); // C++20 1006b8829825SHoward Hinnant explicit weibull_distribution(const param_type& parm); 1007b8829825SHoward Hinnant void reset(); 1008b8829825SHoward Hinnant 1009b8829825SHoward Hinnant // generating functions 1010b8829825SHoward Hinnant template<class URNG> result_type operator()(URNG& g); 1011b8829825SHoward Hinnant template<class URNG> result_type operator()(URNG& g, const param_type& parm); 1012b8829825SHoward Hinnant 1013b8829825SHoward Hinnant // property functions 1014b8829825SHoward Hinnant result_type a() const; 1015b8829825SHoward Hinnant result_type b() const; 1016b8829825SHoward Hinnant 1017b8829825SHoward Hinnant param_type param() const; 1018b8829825SHoward Hinnant void param(const param_type& parm); 1019b8829825SHoward Hinnant 1020b8829825SHoward Hinnant result_type min() const; 1021b8829825SHoward Hinnant result_type max() const; 1022b8829825SHoward Hinnant 1023b8829825SHoward Hinnant friend bool operator==(const weibull_distribution& x, 1024b8829825SHoward Hinnant const weibull_distribution& y); 1025b8829825SHoward Hinnant friend bool operator!=(const weibull_distribution& x, 1026b8829825SHoward Hinnant const weibull_distribution& y); 1027b8829825SHoward Hinnant 1028b8829825SHoward Hinnant template <class charT, class traits> 1029b8829825SHoward Hinnant friend 1030b8829825SHoward Hinnant basic_ostream<charT, traits>& 1031b8829825SHoward Hinnant operator<<(basic_ostream<charT, traits>& os, 1032b8829825SHoward Hinnant const weibull_distribution& x); 1033b8829825SHoward Hinnant 1034b8829825SHoward Hinnant template <class charT, class traits> 1035b8829825SHoward Hinnant friend 1036b8829825SHoward Hinnant basic_istream<charT, traits>& 1037b8829825SHoward Hinnant operator>>(basic_istream<charT, traits>& is, 1038b8829825SHoward Hinnant weibull_distribution& x); 1039b8829825SHoward Hinnant}; 10403e519524SHoward Hinnant 10413e519524SHoward Hinnanttemplate<class RealType = double> 1042c675d983SHoward Hinnantclass extreme_value_distribution 1043c675d983SHoward Hinnant{ 1044c675d983SHoward Hinnantpublic: 1045c675d983SHoward Hinnant // types 1046c675d983SHoward Hinnant typedef RealType result_type; 1047c675d983SHoward Hinnant 1048c675d983SHoward Hinnant class param_type 1049c675d983SHoward Hinnant { 1050c675d983SHoward Hinnant public: 1051c675d983SHoward Hinnant typedef extreme_value_distribution distribution_type; 1052c675d983SHoward Hinnant 1053c675d983SHoward Hinnant explicit param_type(result_type a = 0, result_type b = 1); 1054c675d983SHoward Hinnant 1055c675d983SHoward Hinnant result_type a() const; 1056c675d983SHoward Hinnant result_type b() const; 1057c675d983SHoward Hinnant 1058c675d983SHoward Hinnant friend bool operator==(const param_type& x, const param_type& y); 1059c675d983SHoward Hinnant friend bool operator!=(const param_type& x, const param_type& y); 1060c675d983SHoward Hinnant }; 1061c675d983SHoward Hinnant 1062c675d983SHoward Hinnant // constructor and reset functions 1063a11f8b1aSMarek Kurdej explicit extreme_value_distribution(RealType a = 0.0, RealType b = 1.0); // before C++20 1064a11f8b1aSMarek Kurdej extreme_value_distribution() : extreme_value_distribution(0.0) {} // C++20 1065a11f8b1aSMarek Kurdej explicit extreme_value_distribution(RealType a, RealType b = 1.0); // C++20 1066c675d983SHoward Hinnant explicit extreme_value_distribution(const param_type& parm); 1067c675d983SHoward Hinnant void reset(); 1068c675d983SHoward Hinnant 1069c675d983SHoward Hinnant // generating functions 1070c675d983SHoward Hinnant template<class URNG> result_type operator()(URNG& g); 1071c675d983SHoward Hinnant template<class URNG> result_type operator()(URNG& g, const param_type& parm); 1072c675d983SHoward Hinnant 1073c675d983SHoward Hinnant // property functions 1074c675d983SHoward Hinnant result_type a() const; 1075c675d983SHoward Hinnant result_type b() const; 1076c675d983SHoward Hinnant 1077c675d983SHoward Hinnant param_type param() const; 1078c675d983SHoward Hinnant void param(const param_type& parm); 1079c675d983SHoward Hinnant 1080c675d983SHoward Hinnant result_type min() const; 1081c675d983SHoward Hinnant result_type max() const; 1082c675d983SHoward Hinnant 1083c675d983SHoward Hinnant friend bool operator==(const extreme_value_distribution& x, 1084c675d983SHoward Hinnant const extreme_value_distribution& y); 1085c675d983SHoward Hinnant friend bool operator!=(const extreme_value_distribution& x, 1086c675d983SHoward Hinnant const extreme_value_distribution& y); 1087c675d983SHoward Hinnant 1088c675d983SHoward Hinnant template <class charT, class traits> 1089c675d983SHoward Hinnant friend 1090c675d983SHoward Hinnant basic_ostream<charT, traits>& 1091c675d983SHoward Hinnant operator<<(basic_ostream<charT, traits>& os, 1092c675d983SHoward Hinnant const extreme_value_distribution& x); 1093c675d983SHoward Hinnant 1094c675d983SHoward Hinnant template <class charT, class traits> 1095c675d983SHoward Hinnant friend 1096c675d983SHoward Hinnant basic_istream<charT, traits>& 1097c675d983SHoward Hinnant operator>>(basic_istream<charT, traits>& is, 1098c675d983SHoward Hinnant extreme_value_distribution& x); 1099c675d983SHoward Hinnant}; 11003e519524SHoward Hinnant 11013e519524SHoward Hinnanttemplate<class RealType = double> 11026f97c4e7SHoward Hinnantclass normal_distribution 11036f97c4e7SHoward Hinnant{ 11046f97c4e7SHoward Hinnantpublic: 11056f97c4e7SHoward Hinnant // types 11066f97c4e7SHoward Hinnant typedef RealType result_type; 11076f97c4e7SHoward Hinnant 11086f97c4e7SHoward Hinnant class param_type 11096f97c4e7SHoward Hinnant { 11106f97c4e7SHoward Hinnant public: 11116f97c4e7SHoward Hinnant typedef normal_distribution distribution_type; 11126f97c4e7SHoward Hinnant 11136f97c4e7SHoward Hinnant explicit param_type(result_type mean = 0, result_type stddev = 1); 11146f97c4e7SHoward Hinnant 11156f97c4e7SHoward Hinnant result_type mean() const; 11166f97c4e7SHoward Hinnant result_type stddev() const; 11176f97c4e7SHoward Hinnant 11186f97c4e7SHoward Hinnant friend bool operator==(const param_type& x, const param_type& y); 11196f97c4e7SHoward Hinnant friend bool operator!=(const param_type& x, const param_type& y); 11206f97c4e7SHoward Hinnant }; 11216f97c4e7SHoward Hinnant 11226f97c4e7SHoward Hinnant // constructors and reset functions 1123a11f8b1aSMarek Kurdej explicit normal_distribution(RealType mean = 0.0, RealType stddev = 1.0); // before C++20 1124a11f8b1aSMarek Kurdej normal_distribution() : normal_distribution(0.0) {} // C++20 1125a11f8b1aSMarek Kurdej explicit normal_distribution(RealType mean, RealType stddev = 1.0); // C++20 11266f97c4e7SHoward Hinnant explicit normal_distribution(const param_type& parm); 11276f97c4e7SHoward Hinnant void reset(); 11286f97c4e7SHoward Hinnant 11296f97c4e7SHoward Hinnant // generating functions 11306f97c4e7SHoward Hinnant template<class URNG> result_type operator()(URNG& g); 11316f97c4e7SHoward Hinnant template<class URNG> result_type operator()(URNG& g, const param_type& parm); 11326f97c4e7SHoward Hinnant 11336f97c4e7SHoward Hinnant // property functions 11346f97c4e7SHoward Hinnant result_type mean() const; 11356f97c4e7SHoward Hinnant result_type stddev() const; 11366f97c4e7SHoward Hinnant 11376f97c4e7SHoward Hinnant param_type param() const; 11386f97c4e7SHoward Hinnant void param(const param_type& parm); 11396f97c4e7SHoward Hinnant 11406f97c4e7SHoward Hinnant result_type min() const; 11416f97c4e7SHoward Hinnant result_type max() const; 11426f97c4e7SHoward Hinnant 11436f97c4e7SHoward Hinnant friend bool operator==(const normal_distribution& x, 11446f97c4e7SHoward Hinnant const normal_distribution& y); 11456f97c4e7SHoward Hinnant friend bool operator!=(const normal_distribution& x, 11466f97c4e7SHoward Hinnant const normal_distribution& y); 11476f97c4e7SHoward Hinnant 11486f97c4e7SHoward Hinnant template <class charT, class traits> 11496f97c4e7SHoward Hinnant friend 11506f97c4e7SHoward Hinnant basic_ostream<charT, traits>& 11516f97c4e7SHoward Hinnant operator<<(basic_ostream<charT, traits>& os, 11526f97c4e7SHoward Hinnant const normal_distribution& x); 11536f97c4e7SHoward Hinnant 11546f97c4e7SHoward Hinnant template <class charT, class traits> 11556f97c4e7SHoward Hinnant friend 11566f97c4e7SHoward Hinnant basic_istream<charT, traits>& 11576f97c4e7SHoward Hinnant operator>>(basic_istream<charT, traits>& is, 11586f97c4e7SHoward Hinnant normal_distribution& x); 11596f97c4e7SHoward Hinnant}; 11603e519524SHoward Hinnant 11613e519524SHoward Hinnanttemplate<class RealType = double> 1162fd5c3a34SHoward Hinnantclass lognormal_distribution 1163fd5c3a34SHoward Hinnant{ 1164fd5c3a34SHoward Hinnantpublic: 1165fd5c3a34SHoward Hinnant // types 1166fd5c3a34SHoward Hinnant typedef RealType result_type; 1167fd5c3a34SHoward Hinnant 1168fd5c3a34SHoward Hinnant class param_type 1169fd5c3a34SHoward Hinnant { 1170fd5c3a34SHoward Hinnant public: 1171fd5c3a34SHoward Hinnant typedef lognormal_distribution distribution_type; 1172fd5c3a34SHoward Hinnant 1173fd5c3a34SHoward Hinnant explicit param_type(result_type m = 0, result_type s = 1); 1174fd5c3a34SHoward Hinnant 1175fd5c3a34SHoward Hinnant result_type m() const; 1176fd5c3a34SHoward Hinnant result_type s() const; 1177fd5c3a34SHoward Hinnant 1178fd5c3a34SHoward Hinnant friend bool operator==(const param_type& x, const param_type& y); 1179fd5c3a34SHoward Hinnant friend bool operator!=(const param_type& x, const param_type& y); 1180fd5c3a34SHoward Hinnant }; 1181fd5c3a34SHoward Hinnant 1182fd5c3a34SHoward Hinnant // constructor and reset functions 1183a11f8b1aSMarek Kurdej explicit lognormal_distribution(RealType mean = 0.0, RealType stddev = 1.0); // before C++20 1184a11f8b1aSMarek Kurdej lognormal_distribution() : lognormal_distribution(0.0) {} // C++20 1185a11f8b1aSMarek Kurdej explicit lognormal_distribution(RealType mean, RealType stddev = 1.0); // C++20 1186fd5c3a34SHoward Hinnant explicit lognormal_distribution(const param_type& parm); 1187fd5c3a34SHoward Hinnant void reset(); 1188fd5c3a34SHoward Hinnant 1189fd5c3a34SHoward Hinnant // generating functions 1190fd5c3a34SHoward Hinnant template<class URNG> result_type operator()(URNG& g); 1191fd5c3a34SHoward Hinnant template<class URNG> result_type operator()(URNG& g, const param_type& parm); 1192fd5c3a34SHoward Hinnant 1193fd5c3a34SHoward Hinnant // property functions 1194fd5c3a34SHoward Hinnant result_type m() const; 1195fd5c3a34SHoward Hinnant result_type s() const; 1196fd5c3a34SHoward Hinnant 1197fd5c3a34SHoward Hinnant param_type param() const; 1198fd5c3a34SHoward Hinnant void param(const param_type& parm); 1199fd5c3a34SHoward Hinnant 1200fd5c3a34SHoward Hinnant result_type min() const; 1201fd5c3a34SHoward Hinnant result_type max() const; 1202fd5c3a34SHoward Hinnant 1203fd5c3a34SHoward Hinnant friend bool operator==(const lognormal_distribution& x, 1204fd5c3a34SHoward Hinnant const lognormal_distribution& y); 1205fd5c3a34SHoward Hinnant friend bool operator!=(const lognormal_distribution& x, 1206fd5c3a34SHoward Hinnant const lognormal_distribution& y); 1207fd5c3a34SHoward Hinnant 1208fd5c3a34SHoward Hinnant template <class charT, class traits> 1209fd5c3a34SHoward Hinnant friend 1210fd5c3a34SHoward Hinnant basic_ostream<charT, traits>& 1211fd5c3a34SHoward Hinnant operator<<(basic_ostream<charT, traits>& os, 1212fd5c3a34SHoward Hinnant const lognormal_distribution& x); 1213fd5c3a34SHoward Hinnant 1214fd5c3a34SHoward Hinnant template <class charT, class traits> 1215fd5c3a34SHoward Hinnant friend 1216fd5c3a34SHoward Hinnant basic_istream<charT, traits>& 1217fd5c3a34SHoward Hinnant operator>>(basic_istream<charT, traits>& is, 1218fd5c3a34SHoward Hinnant lognormal_distribution& x); 1219fd5c3a34SHoward Hinnant}; 12203e519524SHoward Hinnant 12213e519524SHoward Hinnanttemplate<class RealType = double> 1222e3900731SHoward Hinnantclass chi_squared_distribution 1223e3900731SHoward Hinnant{ 1224e3900731SHoward Hinnantpublic: 1225e3900731SHoward Hinnant // types 1226e3900731SHoward Hinnant typedef RealType result_type; 1227e3900731SHoward Hinnant 1228e3900731SHoward Hinnant class param_type 1229e3900731SHoward Hinnant { 1230e3900731SHoward Hinnant public: 1231e3900731SHoward Hinnant typedef chi_squared_distribution distribution_type; 1232e3900731SHoward Hinnant 1233e3900731SHoward Hinnant explicit param_type(result_type n = 1); 1234e3900731SHoward Hinnant 1235e3900731SHoward Hinnant result_type n() const; 1236e3900731SHoward Hinnant 1237e3900731SHoward Hinnant friend bool operator==(const param_type& x, const param_type& y); 1238e3900731SHoward Hinnant friend bool operator!=(const param_type& x, const param_type& y); 1239e3900731SHoward Hinnant }; 1240e3900731SHoward Hinnant 1241e3900731SHoward Hinnant // constructor and reset functions 1242a11f8b1aSMarek Kurdej explicit chi_squared_distribution(RealType n = 1.0); // before C++20 1243a11f8b1aSMarek Kurdej chi_squared_distribution() : chi_squared_distribution(1.0) {} // C++20 1244a11f8b1aSMarek Kurdej explicit chi_squared_distribution(RealType n); // C++20 1245e3900731SHoward Hinnant explicit chi_squared_distribution(const param_type& parm); 1246e3900731SHoward Hinnant void reset(); 1247e3900731SHoward Hinnant 1248e3900731SHoward Hinnant // generating functions 1249e3900731SHoward Hinnant template<class URNG> result_type operator()(URNG& g); 1250e3900731SHoward Hinnant template<class URNG> result_type operator()(URNG& g, const param_type& parm); 1251e3900731SHoward Hinnant 1252e3900731SHoward Hinnant // property functions 1253e3900731SHoward Hinnant result_type n() const; 1254e3900731SHoward Hinnant 1255e3900731SHoward Hinnant param_type param() const; 1256e3900731SHoward Hinnant void param(const param_type& parm); 1257e3900731SHoward Hinnant 1258e3900731SHoward Hinnant result_type min() const; 1259e3900731SHoward Hinnant result_type max() const; 1260e3900731SHoward Hinnant 1261e3900731SHoward Hinnant friend bool operator==(const chi_squared_distribution& x, 1262e3900731SHoward Hinnant const chi_squared_distribution& y); 1263e3900731SHoward Hinnant friend bool operator!=(const chi_squared_distribution& x, 1264e3900731SHoward Hinnant const chi_squared_distribution& y); 1265e3900731SHoward Hinnant 1266e3900731SHoward Hinnant template <class charT, class traits> 1267e3900731SHoward Hinnant friend 1268e3900731SHoward Hinnant basic_ostream<charT, traits>& 1269e3900731SHoward Hinnant operator<<(basic_ostream<charT, traits>& os, 1270e3900731SHoward Hinnant const chi_squared_distribution& x); 1271e3900731SHoward Hinnant 1272e3900731SHoward Hinnant template <class charT, class traits> 1273e3900731SHoward Hinnant friend 1274e3900731SHoward Hinnant basic_istream<charT, traits>& 1275e3900731SHoward Hinnant operator>>(basic_istream<charT, traits>& is, 1276e3900731SHoward Hinnant chi_squared_distribution& x); 1277e3900731SHoward Hinnant}; 12783e519524SHoward Hinnant 12793e519524SHoward Hinnanttemplate<class RealType = double> 12806692b261SHoward Hinnantclass cauchy_distribution 12816692b261SHoward Hinnant{ 12826692b261SHoward Hinnantpublic: 12836692b261SHoward Hinnant // types 12846692b261SHoward Hinnant typedef RealType result_type; 12856692b261SHoward Hinnant 12866692b261SHoward Hinnant class param_type 12876692b261SHoward Hinnant { 12886692b261SHoward Hinnant public: 12896692b261SHoward Hinnant typedef cauchy_distribution distribution_type; 12906692b261SHoward Hinnant 12916692b261SHoward Hinnant explicit param_type(result_type a = 0, result_type b = 1); 12926692b261SHoward Hinnant 12936692b261SHoward Hinnant result_type a() const; 12946692b261SHoward Hinnant result_type b() const; 12956692b261SHoward Hinnant 12966692b261SHoward Hinnant friend bool operator==(const param_type& x, const param_type& y); 12976692b261SHoward Hinnant friend bool operator!=(const param_type& x, const param_type& y); 12986692b261SHoward Hinnant }; 12996692b261SHoward Hinnant 13006692b261SHoward Hinnant // constructor and reset functions 1301a11f8b1aSMarek Kurdej explicit cauchy_distribution(RealType a = 0.0, RealType b = 1.0); // before C++20 1302a11f8b1aSMarek Kurdej cauchy_distribution() : cauchy_distribution(0.0) {} // C++20 1303a11f8b1aSMarek Kurdej explicit cauchy_distribution(RealType a, RealType b = 1.0); // C++20 13046692b261SHoward Hinnant explicit cauchy_distribution(const param_type& parm); 13056692b261SHoward Hinnant void reset(); 13066692b261SHoward Hinnant 13076692b261SHoward Hinnant // generating functions 13086692b261SHoward Hinnant template<class URNG> result_type operator()(URNG& g); 13096692b261SHoward Hinnant template<class URNG> result_type operator()(URNG& g, const param_type& parm); 13106692b261SHoward Hinnant 13116692b261SHoward Hinnant // property functions 13126692b261SHoward Hinnant result_type a() const; 13136692b261SHoward Hinnant result_type b() const; 13146692b261SHoward Hinnant 13156692b261SHoward Hinnant param_type param() const; 13166692b261SHoward Hinnant void param(const param_type& parm); 13176692b261SHoward Hinnant 13186692b261SHoward Hinnant result_type min() const; 13196692b261SHoward Hinnant result_type max() const; 13206692b261SHoward Hinnant 13216692b261SHoward Hinnant friend bool operator==(const cauchy_distribution& x, 13226692b261SHoward Hinnant const cauchy_distribution& y); 13236692b261SHoward Hinnant friend bool operator!=(const cauchy_distribution& x, 13246692b261SHoward Hinnant const cauchy_distribution& y); 13256692b261SHoward Hinnant 13266692b261SHoward Hinnant template <class charT, class traits> 13276692b261SHoward Hinnant friend 13286692b261SHoward Hinnant basic_ostream<charT, traits>& 13296692b261SHoward Hinnant operator<<(basic_ostream<charT, traits>& os, 13306692b261SHoward Hinnant const cauchy_distribution& x); 13316692b261SHoward Hinnant 13326692b261SHoward Hinnant template <class charT, class traits> 13336692b261SHoward Hinnant friend 13346692b261SHoward Hinnant basic_istream<charT, traits>& 13356692b261SHoward Hinnant operator>>(basic_istream<charT, traits>& is, 13366692b261SHoward Hinnant cauchy_distribution& x); 13376692b261SHoward Hinnant}; 13383e519524SHoward Hinnant 13393e519524SHoward Hinnanttemplate<class RealType = double> 1340e31e36f9SHoward Hinnantclass fisher_f_distribution 1341e31e36f9SHoward Hinnant{ 1342e31e36f9SHoward Hinnantpublic: 1343e31e36f9SHoward Hinnant // types 1344e31e36f9SHoward Hinnant typedef RealType result_type; 1345e31e36f9SHoward Hinnant 1346e31e36f9SHoward Hinnant class param_type 1347e31e36f9SHoward Hinnant { 1348e31e36f9SHoward Hinnant public: 1349ecbb921cSHoward Hinnant typedef fisher_f_distribution distribution_type; 1350e31e36f9SHoward Hinnant 1351e31e36f9SHoward Hinnant explicit param_type(result_type m = 1, result_type n = 1); 1352e31e36f9SHoward Hinnant 1353e31e36f9SHoward Hinnant result_type m() const; 1354e31e36f9SHoward Hinnant result_type n() const; 1355e31e36f9SHoward Hinnant 1356e31e36f9SHoward Hinnant friend bool operator==(const param_type& x, const param_type& y); 1357e31e36f9SHoward Hinnant friend bool operator!=(const param_type& x, const param_type& y); 1358e31e36f9SHoward Hinnant }; 1359e31e36f9SHoward Hinnant 1360e31e36f9SHoward Hinnant // constructor and reset functions 1361a11f8b1aSMarek Kurdej explicit fisher_f_distribution(RealType m = 1.0, RealType n = 1.0); // before C++20 1362a11f8b1aSMarek Kurdej fisher_f_distribution() : fisher_f_distribution(1.0) {} // C++20 1363a11f8b1aSMarek Kurdej explicit fisher_f_distribution(RealType m, RealType n = 1.0); // C++20 1364e31e36f9SHoward Hinnant explicit fisher_f_distribution(const param_type& parm); 1365e31e36f9SHoward Hinnant void reset(); 1366e31e36f9SHoward Hinnant 1367e31e36f9SHoward Hinnant // generating functions 1368e31e36f9SHoward Hinnant template<class URNG> result_type operator()(URNG& g); 1369e31e36f9SHoward Hinnant template<class URNG> result_type operator()(URNG& g, const param_type& parm); 1370e31e36f9SHoward Hinnant 1371e31e36f9SHoward Hinnant // property functions 1372e31e36f9SHoward Hinnant result_type m() const; 1373e31e36f9SHoward Hinnant result_type n() const; 1374e31e36f9SHoward Hinnant 1375e31e36f9SHoward Hinnant param_type param() const; 1376e31e36f9SHoward Hinnant void param(const param_type& parm); 1377e31e36f9SHoward Hinnant 1378e31e36f9SHoward Hinnant result_type min() const; 1379e31e36f9SHoward Hinnant result_type max() const; 1380e31e36f9SHoward Hinnant 1381e31e36f9SHoward Hinnant friend bool operator==(const fisher_f_distribution& x, 1382e31e36f9SHoward Hinnant const fisher_f_distribution& y); 1383e31e36f9SHoward Hinnant friend bool operator!=(const fisher_f_distribution& x, 1384e31e36f9SHoward Hinnant const fisher_f_distribution& y); 1385e31e36f9SHoward Hinnant 1386e31e36f9SHoward Hinnant template <class charT, class traits> 1387e31e36f9SHoward Hinnant friend 1388e31e36f9SHoward Hinnant basic_ostream<charT, traits>& 1389e31e36f9SHoward Hinnant operator<<(basic_ostream<charT, traits>& os, 1390e31e36f9SHoward Hinnant const fisher_f_distribution& x); 1391e31e36f9SHoward Hinnant 1392e31e36f9SHoward Hinnant template <class charT, class traits> 1393e31e36f9SHoward Hinnant friend 1394e31e36f9SHoward Hinnant basic_istream<charT, traits>& 1395e31e36f9SHoward Hinnant operator>>(basic_istream<charT, traits>& is, 1396e31e36f9SHoward Hinnant fisher_f_distribution& x); 1397e31e36f9SHoward Hinnant}; 13983e519524SHoward Hinnant 13993e519524SHoward Hinnanttemplate<class RealType = double> 1400ecbb921cSHoward Hinnantclass student_t_distribution 1401ecbb921cSHoward Hinnant{ 1402ecbb921cSHoward Hinnantpublic: 1403ecbb921cSHoward Hinnant // types 1404ecbb921cSHoward Hinnant typedef RealType result_type; 1405ecbb921cSHoward Hinnant 1406ecbb921cSHoward Hinnant class param_type 1407ecbb921cSHoward Hinnant { 1408ecbb921cSHoward Hinnant public: 1409ecbb921cSHoward Hinnant typedef student_t_distribution distribution_type; 1410ecbb921cSHoward Hinnant 1411ecbb921cSHoward Hinnant explicit param_type(result_type n = 1); 1412ecbb921cSHoward Hinnant 1413ecbb921cSHoward Hinnant result_type n() const; 1414ecbb921cSHoward Hinnant 1415ecbb921cSHoward Hinnant friend bool operator==(const param_type& x, const param_type& y); 1416ecbb921cSHoward Hinnant friend bool operator!=(const param_type& x, const param_type& y); 1417ecbb921cSHoward Hinnant }; 1418ecbb921cSHoward Hinnant 1419ecbb921cSHoward Hinnant // constructor and reset functions 1420a11f8b1aSMarek Kurdej explicit student_t_distribution(RealType n = 1.0); // before C++20 1421a11f8b1aSMarek Kurdej student_t_distribution() : student_t_distribution(1.0) {} // C++20 1422a11f8b1aSMarek Kurdej explicit student_t_distribution(RealType n); // C++20 1423ecbb921cSHoward Hinnant explicit student_t_distribution(const param_type& parm); 1424ecbb921cSHoward Hinnant void reset(); 1425ecbb921cSHoward Hinnant 1426ecbb921cSHoward Hinnant // generating functions 1427ecbb921cSHoward Hinnant template<class URNG> result_type operator()(URNG& g); 1428ecbb921cSHoward Hinnant template<class URNG> result_type operator()(URNG& g, const param_type& parm); 1429ecbb921cSHoward Hinnant 1430ecbb921cSHoward Hinnant // property functions 1431ecbb921cSHoward Hinnant result_type n() const; 1432ecbb921cSHoward Hinnant 1433ecbb921cSHoward Hinnant param_type param() const; 1434ecbb921cSHoward Hinnant void param(const param_type& parm); 1435ecbb921cSHoward Hinnant 1436ecbb921cSHoward Hinnant result_type min() const; 1437ecbb921cSHoward Hinnant result_type max() const; 1438ecbb921cSHoward Hinnant 1439ecbb921cSHoward Hinnant friend bool operator==(const student_t_distribution& x, 1440ecbb921cSHoward Hinnant const student_t_distribution& y); 1441ecbb921cSHoward Hinnant friend bool operator!=(const student_t_distribution& x, 1442ecbb921cSHoward Hinnant const student_t_distribution& y); 1443ecbb921cSHoward Hinnant 1444ecbb921cSHoward Hinnant template <class charT, class traits> 1445ecbb921cSHoward Hinnant friend 1446ecbb921cSHoward Hinnant basic_ostream<charT, traits>& 1447ecbb921cSHoward Hinnant operator<<(basic_ostream<charT, traits>& os, 1448ecbb921cSHoward Hinnant const student_t_distribution& x); 1449ecbb921cSHoward Hinnant 1450ecbb921cSHoward Hinnant template <class charT, class traits> 1451ecbb921cSHoward Hinnant friend 1452ecbb921cSHoward Hinnant basic_istream<charT, traits>& 1453ecbb921cSHoward Hinnant operator>>(basic_istream<charT, traits>& is, 1454ecbb921cSHoward Hinnant student_t_distribution& x); 1455ecbb921cSHoward Hinnant}; 14563e519524SHoward Hinnant 14573e519524SHoward Hinnanttemplate<class IntType = int> 1458fb0e5ec8SHoward Hinnantclass discrete_distribution 1459fb0e5ec8SHoward Hinnant{ 1460fb0e5ec8SHoward Hinnantpublic: 1461fb0e5ec8SHoward Hinnant // types 1462fb0e5ec8SHoward Hinnant typedef IntType result_type; 1463fb0e5ec8SHoward Hinnant 1464fb0e5ec8SHoward Hinnant class param_type 1465fb0e5ec8SHoward Hinnant { 1466fb0e5ec8SHoward Hinnant public: 1467fb0e5ec8SHoward Hinnant typedef discrete_distribution distribution_type; 1468fb0e5ec8SHoward Hinnant 1469fb0e5ec8SHoward Hinnant param_type(); 1470fb0e5ec8SHoward Hinnant template<class InputIterator> 1471fb0e5ec8SHoward Hinnant param_type(InputIterator firstW, InputIterator lastW); 1472fb0e5ec8SHoward Hinnant param_type(initializer_list<double> wl); 1473fb0e5ec8SHoward Hinnant template<class UnaryOperation> 1474fb0e5ec8SHoward Hinnant param_type(size_t nw, double xmin, double xmax, UnaryOperation fw); 1475fb0e5ec8SHoward Hinnant 1476fb0e5ec8SHoward Hinnant vector<double> probabilities() const; 1477fb0e5ec8SHoward Hinnant 1478fb0e5ec8SHoward Hinnant friend bool operator==(const param_type& x, const param_type& y); 1479fb0e5ec8SHoward Hinnant friend bool operator!=(const param_type& x, const param_type& y); 1480fb0e5ec8SHoward Hinnant }; 1481fb0e5ec8SHoward Hinnant 1482fb0e5ec8SHoward Hinnant // constructor and reset functions 1483fb0e5ec8SHoward Hinnant discrete_distribution(); 1484fb0e5ec8SHoward Hinnant template<class InputIterator> 1485fb0e5ec8SHoward Hinnant discrete_distribution(InputIterator firstW, InputIterator lastW); 1486fb0e5ec8SHoward Hinnant discrete_distribution(initializer_list<double> wl); 1487fb0e5ec8SHoward Hinnant template<class UnaryOperation> 1488fb0e5ec8SHoward Hinnant discrete_distribution(size_t nw, double xmin, double xmax, 1489fb0e5ec8SHoward Hinnant UnaryOperation fw); 1490fb0e5ec8SHoward Hinnant explicit discrete_distribution(const param_type& parm); 1491fb0e5ec8SHoward Hinnant void reset(); 1492fb0e5ec8SHoward Hinnant 1493fb0e5ec8SHoward Hinnant // generating functions 1494fb0e5ec8SHoward Hinnant template<class URNG> result_type operator()(URNG& g); 1495fb0e5ec8SHoward Hinnant template<class URNG> result_type operator()(URNG& g, const param_type& parm); 1496fb0e5ec8SHoward Hinnant 1497fb0e5ec8SHoward Hinnant // property functions 1498fb0e5ec8SHoward Hinnant vector<double> probabilities() const; 1499fb0e5ec8SHoward Hinnant 1500fb0e5ec8SHoward Hinnant param_type param() const; 1501fb0e5ec8SHoward Hinnant void param(const param_type& parm); 1502fb0e5ec8SHoward Hinnant 1503fb0e5ec8SHoward Hinnant result_type min() const; 1504fb0e5ec8SHoward Hinnant result_type max() const; 1505fb0e5ec8SHoward Hinnant 1506fb0e5ec8SHoward Hinnant friend bool operator==(const discrete_distribution& x, 1507fb0e5ec8SHoward Hinnant const discrete_distribution& y); 1508fb0e5ec8SHoward Hinnant friend bool operator!=(const discrete_distribution& x, 1509fb0e5ec8SHoward Hinnant const discrete_distribution& y); 1510fb0e5ec8SHoward Hinnant 1511fb0e5ec8SHoward Hinnant template <class charT, class traits> 1512fb0e5ec8SHoward Hinnant friend 1513fb0e5ec8SHoward Hinnant basic_ostream<charT, traits>& 1514fb0e5ec8SHoward Hinnant operator<<(basic_ostream<charT, traits>& os, 1515fb0e5ec8SHoward Hinnant const discrete_distribution& x); 1516fb0e5ec8SHoward Hinnant 1517fb0e5ec8SHoward Hinnant template <class charT, class traits> 1518fb0e5ec8SHoward Hinnant friend 1519fb0e5ec8SHoward Hinnant basic_istream<charT, traits>& 1520fb0e5ec8SHoward Hinnant operator>>(basic_istream<charT, traits>& is, 1521fb0e5ec8SHoward Hinnant discrete_distribution& x); 1522fb0e5ec8SHoward Hinnant}; 15233e519524SHoward Hinnant 15243e519524SHoward Hinnanttemplate<class RealType = double> 1525e302eab4SHoward Hinnantclass piecewise_constant_distribution 1526e302eab4SHoward Hinnant{ 1527e302eab4SHoward Hinnant // types 1528e302eab4SHoward Hinnant typedef RealType result_type; 1529e302eab4SHoward Hinnant 1530e302eab4SHoward Hinnant class param_type 1531e302eab4SHoward Hinnant { 1532e302eab4SHoward Hinnant public: 1533e302eab4SHoward Hinnant typedef piecewise_constant_distribution distribution_type; 1534e302eab4SHoward Hinnant 1535e302eab4SHoward Hinnant param_type(); 1536e302eab4SHoward Hinnant template<class InputIteratorB, class InputIteratorW> 1537e302eab4SHoward Hinnant param_type(InputIteratorB firstB, InputIteratorB lastB, 1538e302eab4SHoward Hinnant InputIteratorW firstW); 1539e302eab4SHoward Hinnant template<class UnaryOperation> 1540e302eab4SHoward Hinnant param_type(initializer_list<result_type> bl, UnaryOperation fw); 1541e302eab4SHoward Hinnant template<class UnaryOperation> 1542e302eab4SHoward Hinnant param_type(size_t nw, result_type xmin, result_type xmax, 1543e302eab4SHoward Hinnant UnaryOperation fw); 1544e302eab4SHoward Hinnant 1545e302eab4SHoward Hinnant vector<result_type> intervals() const; 1546d518d1c8SHoward Hinnant vector<result_type> densities() const; 1547e302eab4SHoward Hinnant 1548e302eab4SHoward Hinnant friend bool operator==(const param_type& x, const param_type& y); 1549e302eab4SHoward Hinnant friend bool operator!=(const param_type& x, const param_type& y); 1550e302eab4SHoward Hinnant }; 1551e302eab4SHoward Hinnant 1552e302eab4SHoward Hinnant // constructor and reset functions 1553e302eab4SHoward Hinnant piecewise_constant_distribution(); 1554e302eab4SHoward Hinnant template<class InputIteratorB, class InputIteratorW> 1555e302eab4SHoward Hinnant piecewise_constant_distribution(InputIteratorB firstB, 1556e302eab4SHoward Hinnant InputIteratorB lastB, 1557e302eab4SHoward Hinnant InputIteratorW firstW); 1558e302eab4SHoward Hinnant template<class UnaryOperation> 1559e302eab4SHoward Hinnant piecewise_constant_distribution(initializer_list<result_type> bl, 1560e302eab4SHoward Hinnant UnaryOperation fw); 1561e302eab4SHoward Hinnant template<class UnaryOperation> 1562e302eab4SHoward Hinnant piecewise_constant_distribution(size_t nw, result_type xmin, 1563e302eab4SHoward Hinnant result_type xmax, UnaryOperation fw); 1564e302eab4SHoward Hinnant explicit piecewise_constant_distribution(const param_type& parm); 1565e302eab4SHoward Hinnant void reset(); 1566e302eab4SHoward Hinnant 1567e302eab4SHoward Hinnant // generating functions 1568e302eab4SHoward Hinnant template<class URNG> result_type operator()(URNG& g); 1569e302eab4SHoward Hinnant template<class URNG> result_type operator()(URNG& g, const param_type& parm); 1570e302eab4SHoward Hinnant 1571e302eab4SHoward Hinnant // property functions 1572e302eab4SHoward Hinnant vector<result_type> intervals() const; 1573d518d1c8SHoward Hinnant vector<result_type> densities() const; 1574e302eab4SHoward Hinnant 1575e302eab4SHoward Hinnant param_type param() const; 1576e302eab4SHoward Hinnant void param(const param_type& parm); 1577e302eab4SHoward Hinnant 1578e302eab4SHoward Hinnant result_type min() const; 1579e302eab4SHoward Hinnant result_type max() const; 1580e302eab4SHoward Hinnant 1581e302eab4SHoward Hinnant friend bool operator==(const piecewise_constant_distribution& x, 1582e302eab4SHoward Hinnant const piecewise_constant_distribution& y); 1583e302eab4SHoward Hinnant friend bool operator!=(const piecewise_constant_distribution& x, 1584e302eab4SHoward Hinnant const piecewise_constant_distribution& y); 1585e302eab4SHoward Hinnant 1586e302eab4SHoward Hinnant template <class charT, class traits> 1587e302eab4SHoward Hinnant friend 1588e302eab4SHoward Hinnant basic_ostream<charT, traits>& 1589e302eab4SHoward Hinnant operator<<(basic_ostream<charT, traits>& os, 1590e302eab4SHoward Hinnant const piecewise_constant_distribution& x); 1591e302eab4SHoward Hinnant 1592e302eab4SHoward Hinnant template <class charT, class traits> 1593e302eab4SHoward Hinnant friend 1594e302eab4SHoward Hinnant basic_istream<charT, traits>& 1595e302eab4SHoward Hinnant operator>>(basic_istream<charT, traits>& is, 1596e302eab4SHoward Hinnant piecewise_constant_distribution& x); 1597e302eab4SHoward Hinnant}; 15983e519524SHoward Hinnant 15993e519524SHoward Hinnanttemplate<class RealType = double> 1600b4d2fd2fSHoward Hinnantclass piecewise_linear_distribution 1601b4d2fd2fSHoward Hinnant{ 1602b4d2fd2fSHoward Hinnant // types 1603b4d2fd2fSHoward Hinnant typedef RealType result_type; 1604b4d2fd2fSHoward Hinnant 1605b4d2fd2fSHoward Hinnant class param_type 1606b4d2fd2fSHoward Hinnant { 1607b4d2fd2fSHoward Hinnant public: 1608b4d2fd2fSHoward Hinnant typedef piecewise_linear_distribution distribution_type; 1609b4d2fd2fSHoward Hinnant 1610b4d2fd2fSHoward Hinnant param_type(); 1611b4d2fd2fSHoward Hinnant template<class InputIteratorB, class InputIteratorW> 1612b4d2fd2fSHoward Hinnant param_type(InputIteratorB firstB, InputIteratorB lastB, 1613b4d2fd2fSHoward Hinnant InputIteratorW firstW); 1614b4d2fd2fSHoward Hinnant template<class UnaryOperation> 1615b4d2fd2fSHoward Hinnant param_type(initializer_list<result_type> bl, UnaryOperation fw); 1616b4d2fd2fSHoward Hinnant template<class UnaryOperation> 1617b4d2fd2fSHoward Hinnant param_type(size_t nw, result_type xmin, result_type xmax, 1618b4d2fd2fSHoward Hinnant UnaryOperation fw); 1619b4d2fd2fSHoward Hinnant 1620b4d2fd2fSHoward Hinnant vector<result_type> intervals() const; 1621d518d1c8SHoward Hinnant vector<result_type> densities() const; 1622b4d2fd2fSHoward Hinnant 1623b4d2fd2fSHoward Hinnant friend bool operator==(const param_type& x, const param_type& y); 1624b4d2fd2fSHoward Hinnant friend bool operator!=(const param_type& x, const param_type& y); 1625b4d2fd2fSHoward Hinnant }; 1626b4d2fd2fSHoward Hinnant 1627b4d2fd2fSHoward Hinnant // constructor and reset functions 1628b4d2fd2fSHoward Hinnant piecewise_linear_distribution(); 1629b4d2fd2fSHoward Hinnant template<class InputIteratorB, class InputIteratorW> 1630b4d2fd2fSHoward Hinnant piecewise_linear_distribution(InputIteratorB firstB, 1631b4d2fd2fSHoward Hinnant InputIteratorB lastB, 1632b4d2fd2fSHoward Hinnant InputIteratorW firstW); 1633b4d2fd2fSHoward Hinnant 1634b4d2fd2fSHoward Hinnant template<class UnaryOperation> 1635b4d2fd2fSHoward Hinnant piecewise_linear_distribution(initializer_list<result_type> bl, 1636b4d2fd2fSHoward Hinnant UnaryOperation fw); 1637b4d2fd2fSHoward Hinnant 1638b4d2fd2fSHoward Hinnant template<class UnaryOperation> 1639b4d2fd2fSHoward Hinnant piecewise_linear_distribution(size_t nw, result_type xmin, 1640b4d2fd2fSHoward Hinnant result_type xmax, UnaryOperation fw); 1641b4d2fd2fSHoward Hinnant 1642b4d2fd2fSHoward Hinnant explicit piecewise_linear_distribution(const param_type& parm); 1643b4d2fd2fSHoward Hinnant void reset(); 1644b4d2fd2fSHoward Hinnant 1645b4d2fd2fSHoward Hinnant // generating functions 1646b4d2fd2fSHoward Hinnant template<class URNG> result_type operator()(URNG& g); 1647b4d2fd2fSHoward Hinnant template<class URNG> result_type operator()(URNG& g, const param_type& parm); 1648b4d2fd2fSHoward Hinnant 1649b4d2fd2fSHoward Hinnant // property functions 1650b4d2fd2fSHoward Hinnant vector<result_type> intervals() const; 1651d518d1c8SHoward Hinnant vector<result_type> densities() const; 1652b4d2fd2fSHoward Hinnant 1653b4d2fd2fSHoward Hinnant param_type param() const; 1654b4d2fd2fSHoward Hinnant void param(const param_type& parm); 1655b4d2fd2fSHoward Hinnant 1656b4d2fd2fSHoward Hinnant result_type min() const; 1657b4d2fd2fSHoward Hinnant result_type max() const; 1658b4d2fd2fSHoward Hinnant 1659b4d2fd2fSHoward Hinnant friend bool operator==(const piecewise_linear_distribution& x, 1660b4d2fd2fSHoward Hinnant const piecewise_linear_distribution& y); 1661b4d2fd2fSHoward Hinnant friend bool operator!=(const piecewise_linear_distribution& x, 1662b4d2fd2fSHoward Hinnant const piecewise_linear_distribution& y); 1663b4d2fd2fSHoward Hinnant 1664b4d2fd2fSHoward Hinnant template <class charT, class traits> 1665b4d2fd2fSHoward Hinnant friend 1666b4d2fd2fSHoward Hinnant basic_ostream<charT, traits>& 1667b4d2fd2fSHoward Hinnant operator<<(basic_ostream<charT, traits>& os, 1668b4d2fd2fSHoward Hinnant const piecewise_linear_distribution& x); 1669b4d2fd2fSHoward Hinnant 1670b4d2fd2fSHoward Hinnant template <class charT, class traits> 1671b4d2fd2fSHoward Hinnant friend 1672b4d2fd2fSHoward Hinnant basic_istream<charT, traits>& 1673b4d2fd2fSHoward Hinnant operator>>(basic_istream<charT, traits>& is, 1674b4d2fd2fSHoward Hinnant piecewise_linear_distribution& x); 1675b4d2fd2fSHoward Hinnant}; 16763e519524SHoward Hinnant 16773e519524SHoward Hinnant} // std 16783e519524SHoward Hinnant*/ 16793e519524SHoward Hinnant 1680385cc25aSLouis Dionne#include <__assert> // all public C++ headers provide the assertion handler 16813e519524SHoward Hinnant#include <__config> 1682344cef66SArthur O'Dwyer#include <__random/bernoulli_distribution.h> 1683344cef66SArthur O'Dwyer#include <__random/binomial_distribution.h> 1684344cef66SArthur O'Dwyer#include <__random/cauchy_distribution.h> 1685344cef66SArthur O'Dwyer#include <__random/chi_squared_distribution.h> 168681eda008SLouis Dionne#include <__random/clamp_to_integral.h> 1687344cef66SArthur O'Dwyer#include <__random/default_random_engine.h> 1688344cef66SArthur O'Dwyer#include <__random/discard_block_engine.h> 1689344cef66SArthur O'Dwyer#include <__random/discrete_distribution.h> 1690344cef66SArthur O'Dwyer#include <__random/exponential_distribution.h> 1691344cef66SArthur O'Dwyer#include <__random/extreme_value_distribution.h> 1692344cef66SArthur O'Dwyer#include <__random/fisher_f_distribution.h> 1693344cef66SArthur O'Dwyer#include <__random/gamma_distribution.h> 1694344cef66SArthur O'Dwyer#include <__random/generate_canonical.h> 1695344cef66SArthur O'Dwyer#include <__random/geometric_distribution.h> 1696344cef66SArthur O'Dwyer#include <__random/independent_bits_engine.h> 1697344cef66SArthur O'Dwyer#include <__random/is_seed_sequence.h> 1698a3255f21SArthur O'Dwyer#include <__random/is_valid.h> 1699344cef66SArthur O'Dwyer#include <__random/knuth_b.h> 1700344cef66SArthur O'Dwyer#include <__random/linear_congruential_engine.h> 1701344cef66SArthur O'Dwyer#include <__random/log2.h> 1702344cef66SArthur O'Dwyer#include <__random/lognormal_distribution.h> 1703344cef66SArthur O'Dwyer#include <__random/mersenne_twister_engine.h> 1704344cef66SArthur O'Dwyer#include <__random/negative_binomial_distribution.h> 1705344cef66SArthur O'Dwyer#include <__random/normal_distribution.h> 1706344cef66SArthur O'Dwyer#include <__random/piecewise_constant_distribution.h> 1707344cef66SArthur O'Dwyer#include <__random/piecewise_linear_distribution.h> 1708344cef66SArthur O'Dwyer#include <__random/poisson_distribution.h> 1709344cef66SArthur O'Dwyer#include <__random/random_device.h> 1710344cef66SArthur O'Dwyer#include <__random/ranlux.h> 1711344cef66SArthur O'Dwyer#include <__random/seed_seq.h> 1712344cef66SArthur O'Dwyer#include <__random/shuffle_order_engine.h> 1713344cef66SArthur O'Dwyer#include <__random/student_t_distribution.h> 1714344cef66SArthur O'Dwyer#include <__random/subtract_with_carry_engine.h> 1715134723edSLouis Dionne#include <__random/uniform_int_distribution.h> 1716344cef66SArthur O'Dwyer#include <__random/uniform_random_bit_generator.h> 1717344cef66SArthur O'Dwyer#include <__random/uniform_real_distribution.h> 1718344cef66SArthur O'Dwyer#include <__random/weibull_distribution.h> 1719bd6e6846SMark de Wever#include <version> 1720344cef66SArthur O'Dwyer 1721*de4a57cbSLouis Dionne#ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES 1722*de4a57cbSLouis Dionne# include <algorithm> 1723*de4a57cbSLouis Dionne#endif 1724*de4a57cbSLouis Dionne 1725db1978b6SNikolas Klauser// standard-mandated includes 1726db1978b6SNikolas Klauser#include <initializer_list> 1727db1978b6SNikolas Klauser 1728344cef66SArthur O'Dwyer#include <cmath> // for backward compatibility; TODO remove it 1729344cef66SArthur O'Dwyer#include <cstddef> // for backward compatibility; TODO remove it 1730344cef66SArthur O'Dwyer#include <cstdint> // for backward compatibility; TODO remove it 1731344cef66SArthur O'Dwyer#include <iosfwd> // for backward compatibility; TODO remove it 1732344cef66SArthur O'Dwyer#include <limits> // for backward compatibility; TODO remove it 1733344cef66SArthur O'Dwyer#include <numeric> // for backward compatibility; TODO remove it 1734344cef66SArthur O'Dwyer#include <string> // for backward compatibility; TODO remove it 1735344cef66SArthur O'Dwyer#include <type_traits> // for backward compatibility; TODO remove it 1736344cef66SArthur O'Dwyer#include <vector> // for backward compatibility; TODO remove it 17373e519524SHoward Hinnant 1738073458b1SHoward Hinnant#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 17393e519524SHoward Hinnant# pragma GCC system_header 1740073458b1SHoward Hinnant#endif 17413e519524SHoward Hinnant 17423e519524SHoward Hinnant#endif // _LIBCPP_RANDOM 1743