xref: /freebsd/contrib/llvm-project/libcxx/include/random (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
10b57cec5SDimitry Andric// -*- C++ -*-
2349cc55cSDimitry Andric//===----------------------------------------------------------------------===//
30b57cec5SDimitry Andric//
40b57cec5SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
50b57cec5SDimitry Andric// See https://llvm.org/LICENSE.txt for license information.
60b57cec5SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
70b57cec5SDimitry Andric//
80b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
90b57cec5SDimitry Andric
100b57cec5SDimitry Andric#ifndef _LIBCPP_RANDOM
110b57cec5SDimitry Andric#define _LIBCPP_RANDOM
120b57cec5SDimitry Andric
130b57cec5SDimitry Andric/*
140b57cec5SDimitry Andric    random synopsis
150b57cec5SDimitry Andric
160b57cec5SDimitry Andric#include <initializer_list>
170b57cec5SDimitry Andric
180b57cec5SDimitry Andricnamespace std
190b57cec5SDimitry Andric{
20fe6060f1SDimitry Andric// [rand.req.urng], uniform random bit generator requirements
21fe6060f1SDimitry Andrictemplate<class G>
22fe6060f1SDimitry Andricconcept uniform_random_bit_generator = see below; // C++20
230b57cec5SDimitry Andric
240b57cec5SDimitry Andric// Engines
250b57cec5SDimitry Andric
260b57cec5SDimitry Andrictemplate <class UIntType, UIntType a, UIntType c, UIntType m>
270b57cec5SDimitry Andricclass linear_congruential_engine
280b57cec5SDimitry Andric{
290b57cec5SDimitry Andricpublic:
300b57cec5SDimitry Andric    // types
310b57cec5SDimitry Andric    typedef UIntType result_type;
320b57cec5SDimitry Andric
330b57cec5SDimitry Andric    // engine characteristics
340b57cec5SDimitry Andric    static constexpr result_type multiplier = a;
350b57cec5SDimitry Andric    static constexpr result_type increment = c;
360b57cec5SDimitry Andric    static constexpr result_type modulus = m;
370b57cec5SDimitry Andric    static constexpr result_type min() { return c == 0u ? 1u: 0u;}
380b57cec5SDimitry Andric    static constexpr result_type max() { return m - 1u;}
390b57cec5SDimitry Andric    static constexpr result_type default_seed = 1u;
400b57cec5SDimitry Andric
410b57cec5SDimitry Andric    // constructors and seeding functions
42e8d8bef9SDimitry Andric    explicit linear_congruential_engine(result_type s = default_seed);         // before C++20
43e8d8bef9SDimitry Andric    linear_congruential_engine() : linear_congruential_engine(default_seed) {} // C++20
44e8d8bef9SDimitry Andric    explicit linear_congruential_engine(result_type s);                        // C++20
450b57cec5SDimitry Andric    template<class Sseq> explicit linear_congruential_engine(Sseq& q);
460b57cec5SDimitry Andric    void seed(result_type s = default_seed);
470b57cec5SDimitry Andric    template<class Sseq> void seed(Sseq& q);
480b57cec5SDimitry Andric
490b57cec5SDimitry Andric    // generating functions
500b57cec5SDimitry Andric    result_type operator()();
510b57cec5SDimitry Andric    void discard(unsigned long long z);
520b57cec5SDimitry Andric};
530b57cec5SDimitry Andric
540b57cec5SDimitry Andrictemplate <class UIntType, UIntType a, UIntType c, UIntType m>
550b57cec5SDimitry Andricbool
560b57cec5SDimitry Andricoperator==(const linear_congruential_engine<UIntType, a, c, m>& x,
570b57cec5SDimitry Andric           const linear_congruential_engine<UIntType, a, c, m>& y);
580b57cec5SDimitry Andric
590b57cec5SDimitry Andrictemplate <class UIntType, UIntType a, UIntType c, UIntType m>
600b57cec5SDimitry Andricbool
610b57cec5SDimitry Andricoperator!=(const linear_congruential_engine<UIntType, a, c, m>& x,
620b57cec5SDimitry Andric           const linear_congruential_engine<UIntType, a, c, m>& y);
630b57cec5SDimitry Andric
640b57cec5SDimitry Andrictemplate <class charT, class traits,
650b57cec5SDimitry Andric          class UIntType, UIntType a, UIntType c, UIntType m>
660b57cec5SDimitry Andricbasic_ostream<charT, traits>&
670b57cec5SDimitry Andricoperator<<(basic_ostream<charT, traits>& os,
680b57cec5SDimitry Andric           const linear_congruential_engine<UIntType, a, c, m>& x);
690b57cec5SDimitry Andric
700b57cec5SDimitry Andrictemplate <class charT, class traits,
710b57cec5SDimitry Andric          class UIntType, UIntType a, UIntType c, UIntType m>
720b57cec5SDimitry Andricbasic_istream<charT, traits>&
730b57cec5SDimitry Andricoperator>>(basic_istream<charT, traits>& is,
740b57cec5SDimitry Andric           linear_congruential_engine<UIntType, a, c, m>& x);
750b57cec5SDimitry Andric
760b57cec5SDimitry Andrictemplate <class UIntType, size_t w, size_t n, size_t m, size_t r,
770b57cec5SDimitry Andric          UIntType a, size_t u, UIntType d, size_t s,
780b57cec5SDimitry Andric          UIntType b, size_t t, UIntType c, size_t l, UIntType f>
790b57cec5SDimitry Andricclass mersenne_twister_engine
800b57cec5SDimitry Andric{
810b57cec5SDimitry Andricpublic:
820b57cec5SDimitry Andric    // types
830b57cec5SDimitry Andric    typedef UIntType result_type;
840b57cec5SDimitry Andric
850b57cec5SDimitry Andric    // engine characteristics
860b57cec5SDimitry Andric    static constexpr size_t word_size = w;
870b57cec5SDimitry Andric    static constexpr size_t state_size = n;
880b57cec5SDimitry Andric    static constexpr size_t shift_size = m;
890b57cec5SDimitry Andric    static constexpr size_t mask_bits = r;
900b57cec5SDimitry Andric    static constexpr result_type xor_mask = a;
910b57cec5SDimitry Andric    static constexpr size_t tempering_u = u;
920b57cec5SDimitry Andric    static constexpr result_type tempering_d = d;
930b57cec5SDimitry Andric    static constexpr size_t tempering_s = s;
940b57cec5SDimitry Andric    static constexpr result_type tempering_b = b;
950b57cec5SDimitry Andric    static constexpr size_t tempering_t = t;
960b57cec5SDimitry Andric    static constexpr result_type tempering_c = c;
970b57cec5SDimitry Andric    static constexpr size_t tempering_l = l;
980b57cec5SDimitry Andric    static constexpr result_type initialization_multiplier = f;
990b57cec5SDimitry Andric    static constexpr result_type min () { return 0; }
1000b57cec5SDimitry Andric    static constexpr result_type max() { return 2^w - 1; }
1010b57cec5SDimitry Andric    static constexpr result_type default_seed = 5489u;
1020b57cec5SDimitry Andric
1030b57cec5SDimitry Andric    // constructors and seeding functions
104e8d8bef9SDimitry Andric    explicit mersenne_twister_engine(result_type s = default_seed);      // before C++20
105e8d8bef9SDimitry Andric    mersenne_twister_engine() : mersenne_twister_engine(default_seed) {} // C++20
106e8d8bef9SDimitry Andric    explicit mersenne_twister_engine(result_type s);                     // C++20
1070b57cec5SDimitry Andric    template<class Sseq> explicit mersenne_twister_engine(Sseq& q);
1080b57cec5SDimitry Andric    void seed(result_type value = default_seed);
1090b57cec5SDimitry Andric    template<class Sseq> void seed(Sseq& q);
1100b57cec5SDimitry Andric
1110b57cec5SDimitry Andric    // generating functions
1120b57cec5SDimitry Andric    result_type operator()();
1130b57cec5SDimitry Andric    void discard(unsigned long long z);
1140b57cec5SDimitry Andric};
1150b57cec5SDimitry Andric
1160b57cec5SDimitry Andrictemplate <class UIntType, size_t w, size_t n, size_t m, size_t r,
1170b57cec5SDimitry Andric          UIntType a, size_t u, UIntType d, size_t s,
1180b57cec5SDimitry Andric          UIntType b, size_t t, UIntType c, size_t l, UIntType f>
1190b57cec5SDimitry Andricbool
1200b57cec5SDimitry Andricoperator==(
1210b57cec5SDimitry Andric    const mersenne_twister_engine<UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f>& x,
1220b57cec5SDimitry Andric    const mersenne_twister_engine<UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f>& y);
1230b57cec5SDimitry Andric
1240b57cec5SDimitry Andrictemplate <class UIntType, size_t w, size_t n, size_t m, size_t r,
1250b57cec5SDimitry Andric          UIntType a, size_t u, UIntType d, size_t s,
1260b57cec5SDimitry Andric          UIntType b, size_t t, UIntType c, size_t l, UIntType f>
1270b57cec5SDimitry Andricbool
1280b57cec5SDimitry Andricoperator!=(
1290b57cec5SDimitry Andric    const mersenne_twister_engine<UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f>& x,
1300b57cec5SDimitry Andric    const mersenne_twister_engine<UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f>& y);
1310b57cec5SDimitry Andric
1320b57cec5SDimitry Andrictemplate <class charT, class traits,
1330b57cec5SDimitry Andric          class UIntType, size_t w, size_t n, size_t m, size_t r,
1340b57cec5SDimitry Andric          UIntType a, size_t u, UIntType d, size_t s,
1350b57cec5SDimitry Andric          UIntType b, size_t t, UIntType c, size_t l, UIntType f>
1360b57cec5SDimitry Andricbasic_ostream<charT, traits>&
1370b57cec5SDimitry Andricoperator<<(basic_ostream<charT, traits>& os,
1380b57cec5SDimitry Andric           const mersenne_twister_engine<UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f>& x);
1390b57cec5SDimitry Andric
1400b57cec5SDimitry Andrictemplate <class charT, class traits,
1410b57cec5SDimitry Andric          class UIntType, size_t w, size_t n, size_t m, size_t r,
1420b57cec5SDimitry Andric          UIntType a, size_t u, UIntType d, size_t s,
1430b57cec5SDimitry Andric          UIntType b, size_t t, UIntType c, size_t l, UIntType f>
1440b57cec5SDimitry Andricbasic_istream<charT, traits>&
1450b57cec5SDimitry Andricoperator>>(basic_istream<charT, traits>& is,
1460b57cec5SDimitry Andric           mersenne_twister_engine<UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f>& x);
1470b57cec5SDimitry Andric
1480b57cec5SDimitry Andrictemplate<class UIntType, size_t w, size_t s, size_t r>
1490b57cec5SDimitry Andricclass subtract_with_carry_engine
1500b57cec5SDimitry Andric{
1510b57cec5SDimitry Andricpublic:
1520b57cec5SDimitry Andric    // types
1530b57cec5SDimitry Andric    typedef UIntType result_type;
1540b57cec5SDimitry Andric
1550b57cec5SDimitry Andric    // engine characteristics
1560b57cec5SDimitry Andric    static constexpr size_t word_size = w;
1570b57cec5SDimitry Andric    static constexpr size_t short_lag = s;
1580b57cec5SDimitry Andric    static constexpr size_t long_lag = r;
1590b57cec5SDimitry Andric    static constexpr result_type min() { return 0; }
1600b57cec5SDimitry Andric    static constexpr result_type max() { return m-1; }
1610b57cec5SDimitry Andric    static constexpr result_type default_seed = 19780503u;
1620b57cec5SDimitry Andric
1630b57cec5SDimitry Andric    // constructors and seeding functions
164e8d8bef9SDimitry Andric    explicit subtract_with_carry_engine(result_type value = default_seed);     // before C++20
165e8d8bef9SDimitry Andric    subtract_with_carry_engine() : subtract_with_carry_engine(default_seed) {} // C++20
166e8d8bef9SDimitry Andric    explicit subtract_with_carry_engine(result_type value);                    // C++20
1670b57cec5SDimitry Andric    template<class Sseq> explicit subtract_with_carry_engine(Sseq& q);
1680b57cec5SDimitry Andric    void seed(result_type value = default_seed);
1690b57cec5SDimitry Andric    template<class Sseq> void seed(Sseq& q);
1700b57cec5SDimitry Andric
1710b57cec5SDimitry Andric    // generating functions
1720b57cec5SDimitry Andric    result_type operator()();
1730b57cec5SDimitry Andric    void discard(unsigned long long z);
1740b57cec5SDimitry Andric};
1750b57cec5SDimitry Andric
1760b57cec5SDimitry Andrictemplate<class UIntType, size_t w, size_t s, size_t r>
1770b57cec5SDimitry Andricbool
1780b57cec5SDimitry Andricoperator==(
1790b57cec5SDimitry Andric    const subtract_with_carry_engine<UIntType, w, s, r>& x,
1800b57cec5SDimitry Andric    const subtract_with_carry_engine<UIntType, w, s, r>& y);
1810b57cec5SDimitry Andric
1820b57cec5SDimitry Andrictemplate<class UIntType, size_t w, size_t s, size_t r>
1830b57cec5SDimitry Andricbool
1840b57cec5SDimitry Andricoperator!=(
1850b57cec5SDimitry Andric    const subtract_with_carry_engine<UIntType, w, s, r>& x,
1860b57cec5SDimitry Andric    const subtract_with_carry_engine<UIntType, w, s, r>& y);
1870b57cec5SDimitry Andric
1880b57cec5SDimitry Andrictemplate <class charT, class traits,
1890b57cec5SDimitry Andric          class UIntType, size_t w, size_t s, size_t r>
1900b57cec5SDimitry Andricbasic_ostream<charT, traits>&
1910b57cec5SDimitry Andricoperator<<(basic_ostream<charT, traits>& os,
1920b57cec5SDimitry Andric           const subtract_with_carry_engine<UIntType, w, s, r>& x);
1930b57cec5SDimitry Andric
1940b57cec5SDimitry Andrictemplate <class charT, class traits,
1950b57cec5SDimitry Andric          class UIntType, size_t w, size_t s, size_t r>
1960b57cec5SDimitry Andricbasic_istream<charT, traits>&
1970b57cec5SDimitry Andricoperator>>(basic_istream<charT, traits>& is,
1980b57cec5SDimitry Andric           subtract_with_carry_engine<UIntType, w, s, r>& x);
1990b57cec5SDimitry Andric
2000b57cec5SDimitry Andrictemplate<class Engine, size_t p, size_t r>
2010b57cec5SDimitry Andricclass discard_block_engine
2020b57cec5SDimitry Andric{
2030b57cec5SDimitry Andricpublic:
2040b57cec5SDimitry Andric    // types
2050b57cec5SDimitry Andric    typedef typename Engine::result_type result_type;
2060b57cec5SDimitry Andric
2070b57cec5SDimitry Andric    // engine characteristics
2080b57cec5SDimitry Andric    static constexpr size_t block_size = p;
2090b57cec5SDimitry Andric    static constexpr size_t used_block = r;
2100b57cec5SDimitry Andric    static constexpr result_type min() { return Engine::min(); }
2110b57cec5SDimitry Andric    static constexpr result_type max() { return Engine::max(); }
2120b57cec5SDimitry Andric
2130b57cec5SDimitry Andric    // constructors and seeding functions
2140b57cec5SDimitry Andric    discard_block_engine();
2150b57cec5SDimitry Andric    explicit discard_block_engine(const Engine& e);
2160b57cec5SDimitry Andric    explicit discard_block_engine(Engine&& e);
2170b57cec5SDimitry Andric    explicit discard_block_engine(result_type s);
2180b57cec5SDimitry Andric    template<class Sseq> explicit discard_block_engine(Sseq& q);
2190b57cec5SDimitry Andric    void seed();
2200b57cec5SDimitry Andric    void seed(result_type s);
2210b57cec5SDimitry Andric    template<class Sseq> void seed(Sseq& q);
2220b57cec5SDimitry Andric
2230b57cec5SDimitry Andric    // generating functions
2240b57cec5SDimitry Andric    result_type operator()();
2250b57cec5SDimitry Andric    void discard(unsigned long long z);
2260b57cec5SDimitry Andric
2270b57cec5SDimitry Andric    // property functions
2280b57cec5SDimitry Andric    const Engine& base() const noexcept;
2290b57cec5SDimitry Andric};
2300b57cec5SDimitry Andric
2310b57cec5SDimitry Andrictemplate<class Engine, size_t p, size_t r>
2320b57cec5SDimitry Andricbool
2330b57cec5SDimitry Andricoperator==(
2340b57cec5SDimitry Andric    const discard_block_engine<Engine, p, r>& x,
2350b57cec5SDimitry Andric    const discard_block_engine<Engine, p, r>& y);
2360b57cec5SDimitry Andric
2370b57cec5SDimitry Andrictemplate<class Engine, size_t p, size_t r>
2380b57cec5SDimitry Andricbool
2390b57cec5SDimitry Andricoperator!=(
2400b57cec5SDimitry Andric    const discard_block_engine<Engine, p, r>& x,
2410b57cec5SDimitry Andric    const discard_block_engine<Engine, p, r>& y);
2420b57cec5SDimitry Andric
2430b57cec5SDimitry Andrictemplate <class charT, class traits,
2440b57cec5SDimitry Andric          class Engine, size_t p, size_t r>
2450b57cec5SDimitry Andricbasic_ostream<charT, traits>&
2460b57cec5SDimitry Andricoperator<<(basic_ostream<charT, traits>& os,
2470b57cec5SDimitry Andric           const discard_block_engine<Engine, p, r>& x);
2480b57cec5SDimitry Andric
2490b57cec5SDimitry Andrictemplate <class charT, class traits,
2500b57cec5SDimitry Andric          class Engine, size_t p, size_t r>
2510b57cec5SDimitry Andricbasic_istream<charT, traits>&
2520b57cec5SDimitry Andricoperator>>(basic_istream<charT, traits>& is,
2530b57cec5SDimitry Andric           discard_block_engine<Engine, p, r>& x);
2540b57cec5SDimitry Andric
2550b57cec5SDimitry Andrictemplate<class Engine, size_t w, class UIntType>
2560b57cec5SDimitry Andricclass independent_bits_engine
2570b57cec5SDimitry Andric{
2580b57cec5SDimitry Andricpublic:
2590b57cec5SDimitry Andric    // types
2600b57cec5SDimitry Andric    typedef UIntType result_type;
2610b57cec5SDimitry Andric
2620b57cec5SDimitry Andric    // engine characteristics
2630b57cec5SDimitry Andric    static constexpr result_type min() { return 0; }
2640b57cec5SDimitry Andric    static constexpr result_type max() { return 2^w - 1; }
2650b57cec5SDimitry Andric
2660b57cec5SDimitry Andric    // constructors and seeding functions
2670b57cec5SDimitry Andric    independent_bits_engine();
2680b57cec5SDimitry Andric    explicit independent_bits_engine(const Engine& e);
2690b57cec5SDimitry Andric    explicit independent_bits_engine(Engine&& e);
2700b57cec5SDimitry Andric    explicit independent_bits_engine(result_type s);
2710b57cec5SDimitry Andric    template<class Sseq> explicit independent_bits_engine(Sseq& q);
2720b57cec5SDimitry Andric    void seed();
2730b57cec5SDimitry Andric    void seed(result_type s);
2740b57cec5SDimitry Andric    template<class Sseq> void seed(Sseq& q);
2750b57cec5SDimitry Andric
2760b57cec5SDimitry Andric    // generating functions
2770b57cec5SDimitry Andric    result_type operator()(); void discard(unsigned long long z);
2780b57cec5SDimitry Andric
2790b57cec5SDimitry Andric    // property functions
2800b57cec5SDimitry Andric    const Engine& base() const noexcept;
2810b57cec5SDimitry Andric};
2820b57cec5SDimitry Andric
2830b57cec5SDimitry Andrictemplate<class Engine, size_t w, class UIntType>
2840b57cec5SDimitry Andricbool
2850b57cec5SDimitry Andricoperator==(
2860b57cec5SDimitry Andric    const independent_bits_engine<Engine, w, UIntType>& x,
2870b57cec5SDimitry Andric    const independent_bits_engine<Engine, w, UIntType>& y);
2880b57cec5SDimitry Andric
2890b57cec5SDimitry Andrictemplate<class Engine, size_t w, class UIntType>
2900b57cec5SDimitry Andricbool
2910b57cec5SDimitry Andricoperator!=(
2920b57cec5SDimitry Andric    const independent_bits_engine<Engine, w, UIntType>& x,
2930b57cec5SDimitry Andric    const independent_bits_engine<Engine, w, UIntType>& y);
2940b57cec5SDimitry Andric
2950b57cec5SDimitry Andrictemplate <class charT, class traits,
2960b57cec5SDimitry Andric          class Engine, size_t w, class UIntType>
2970b57cec5SDimitry Andricbasic_ostream<charT, traits>&
2980b57cec5SDimitry Andricoperator<<(basic_ostream<charT, traits>& os,
2990b57cec5SDimitry Andric           const independent_bits_engine<Engine, w, UIntType>& x);
3000b57cec5SDimitry Andric
3010b57cec5SDimitry Andrictemplate <class charT, class traits,
3020b57cec5SDimitry Andric          class Engine, size_t w, class UIntType>
3030b57cec5SDimitry Andricbasic_istream<charT, traits>&
3040b57cec5SDimitry Andricoperator>>(basic_istream<charT, traits>& is,
3050b57cec5SDimitry Andric           independent_bits_engine<Engine, w, UIntType>& x);
3060b57cec5SDimitry Andric
3070b57cec5SDimitry Andrictemplate<class Engine, size_t k>
3080b57cec5SDimitry Andricclass shuffle_order_engine
3090b57cec5SDimitry Andric{
3100b57cec5SDimitry Andricpublic:
3110b57cec5SDimitry Andric    // types
3120b57cec5SDimitry Andric    typedef typename Engine::result_type result_type;
3130b57cec5SDimitry Andric
3140b57cec5SDimitry Andric    // engine characteristics
3150b57cec5SDimitry Andric    static constexpr size_t table_size = k;
3160b57cec5SDimitry Andric    static constexpr result_type min() { return Engine::min; }
3170b57cec5SDimitry Andric    static constexpr result_type max() { return Engine::max; }
3180b57cec5SDimitry Andric
3190b57cec5SDimitry Andric    // constructors and seeding functions
3200b57cec5SDimitry Andric    shuffle_order_engine();
3210b57cec5SDimitry Andric    explicit shuffle_order_engine(const Engine& e);
3220b57cec5SDimitry Andric    explicit shuffle_order_engine(Engine&& e);
3230b57cec5SDimitry Andric    explicit shuffle_order_engine(result_type s);
3240b57cec5SDimitry Andric    template<class Sseq> explicit shuffle_order_engine(Sseq& q);
3250b57cec5SDimitry Andric    void seed();
3260b57cec5SDimitry Andric    void seed(result_type s);
3270b57cec5SDimitry Andric    template<class Sseq> void seed(Sseq& q);
3280b57cec5SDimitry Andric
3290b57cec5SDimitry Andric    // generating functions
3300b57cec5SDimitry Andric    result_type operator()();
3310b57cec5SDimitry Andric    void discard(unsigned long long z);
3320b57cec5SDimitry Andric
3330b57cec5SDimitry Andric    // property functions
3340b57cec5SDimitry Andric    const Engine& base() const noexcept;
3350b57cec5SDimitry Andric};
3360b57cec5SDimitry Andric
3370b57cec5SDimitry Andrictemplate<class Engine, size_t k>
3380b57cec5SDimitry Andricbool
3390b57cec5SDimitry Andricoperator==(
3400b57cec5SDimitry Andric    const shuffle_order_engine<Engine, k>& x,
3410b57cec5SDimitry Andric    const shuffle_order_engine<Engine, k>& y);
3420b57cec5SDimitry Andric
3430b57cec5SDimitry Andrictemplate<class Engine, size_t k>
3440b57cec5SDimitry Andricbool
3450b57cec5SDimitry Andricoperator!=(
3460b57cec5SDimitry Andric    const shuffle_order_engine<Engine, k>& x,
3470b57cec5SDimitry Andric    const shuffle_order_engine<Engine, k>& y);
3480b57cec5SDimitry Andric
3490b57cec5SDimitry Andrictemplate <class charT, class traits,
3500b57cec5SDimitry Andric          class Engine, size_t k>
3510b57cec5SDimitry Andricbasic_ostream<charT, traits>&
3520b57cec5SDimitry Andricoperator<<(basic_ostream<charT, traits>& os,
3530b57cec5SDimitry Andric           const shuffle_order_engine<Engine, k>& x);
3540b57cec5SDimitry Andric
3550b57cec5SDimitry Andrictemplate <class charT, class traits,
3560b57cec5SDimitry Andric          class Engine, size_t k>
3570b57cec5SDimitry Andricbasic_istream<charT, traits>&
3580b57cec5SDimitry Andricoperator>>(basic_istream<charT, traits>& is,
3590b57cec5SDimitry Andric           shuffle_order_engine<Engine, k>& x);
3600b57cec5SDimitry Andric
3610b57cec5SDimitry Andrictypedef linear_congruential_engine<uint_fast32_t, 16807, 0, 2147483647>
3620b57cec5SDimitry Andric                                                                   minstd_rand0;
3630b57cec5SDimitry Andrictypedef linear_congruential_engine<uint_fast32_t, 48271, 0, 2147483647>
3640b57cec5SDimitry Andric                                                                    minstd_rand;
3650b57cec5SDimitry Andrictypedef mersenne_twister_engine<uint_fast32_t, 32, 624, 397, 31,
3660b57cec5SDimitry Andric                                0x9908b0df,
3670b57cec5SDimitry Andric                                11, 0xffffffff,
3680b57cec5SDimitry Andric                                7,  0x9d2c5680,
3690b57cec5SDimitry Andric                                15, 0xefc60000,
3700b57cec5SDimitry Andric                                18, 1812433253>                         mt19937;
3710b57cec5SDimitry Andrictypedef mersenne_twister_engine<uint_fast64_t, 64, 312, 156, 31,
3720b57cec5SDimitry Andric                                0xb5026f5aa96619e9,
3730b57cec5SDimitry Andric                                29, 0x5555555555555555,
3740b57cec5SDimitry Andric                                17, 0x71d67fffeda60000,
3750b57cec5SDimitry Andric                                37, 0xfff7eee000000000,
3760b57cec5SDimitry Andric                                43, 6364136223846793005>             mt19937_64;
3770b57cec5SDimitry Andrictypedef subtract_with_carry_engine<uint_fast32_t, 24, 10, 24>     ranlux24_base;
3780b57cec5SDimitry Andrictypedef subtract_with_carry_engine<uint_fast64_t, 48,  5, 12>     ranlux48_base;
3790b57cec5SDimitry Andrictypedef discard_block_engine<ranlux24_base, 223, 23>                   ranlux24;
3800b57cec5SDimitry Andrictypedef discard_block_engine<ranlux48_base, 389, 11>                   ranlux48;
3810b57cec5SDimitry Andrictypedef shuffle_order_engine<minstd_rand0, 256>                         knuth_b;
3820b57cec5SDimitry Andrictypedef minstd_rand                                       default_random_engine;
3830b57cec5SDimitry Andric
3840b57cec5SDimitry Andric// Generators
3850b57cec5SDimitry Andric
3860b57cec5SDimitry Andricclass random_device
3870b57cec5SDimitry Andric{
3880b57cec5SDimitry Andricpublic:
3890b57cec5SDimitry Andric    // types
3900b57cec5SDimitry Andric    typedef unsigned int result_type;
3910b57cec5SDimitry Andric
3920b57cec5SDimitry Andric    // generator characteristics
3930b57cec5SDimitry Andric    static constexpr result_type min() { return numeric_limits<result_type>::min(); }
3940b57cec5SDimitry Andric    static constexpr result_type max() { return numeric_limits<result_type>::max(); }
3950b57cec5SDimitry Andric
3960b57cec5SDimitry Andric    // constructors
397e8d8bef9SDimitry Andric    explicit random_device(const string& token = implementation-defined); // before C++20
398e8d8bef9SDimitry Andric    random_device() : random_device(implementation-defined) {}            // C++20
399e8d8bef9SDimitry Andric    explicit random_device(const string& token);                          // C++20
4000b57cec5SDimitry Andric
4010b57cec5SDimitry Andric    // generating functions
4020b57cec5SDimitry Andric    result_type operator()();
4030b57cec5SDimitry Andric
4040b57cec5SDimitry Andric    // property functions
4050b57cec5SDimitry Andric    double entropy() const noexcept;
4060b57cec5SDimitry Andric
4070b57cec5SDimitry Andric    // no copy functions
4080b57cec5SDimitry Andric    random_device(const random_device& ) = delete;
4090b57cec5SDimitry Andric    void operator=(const random_device& ) = delete;
4100b57cec5SDimitry Andric};
4110b57cec5SDimitry Andric
4120b57cec5SDimitry Andric// Utilities
4130b57cec5SDimitry Andric
4140b57cec5SDimitry Andricclass seed_seq
4150b57cec5SDimitry Andric{
4160b57cec5SDimitry Andricpublic:
4170b57cec5SDimitry Andric    // types
4180b57cec5SDimitry Andric    typedef uint_least32_t result_type;
4190b57cec5SDimitry Andric
4200b57cec5SDimitry Andric    // constructors
4210b57cec5SDimitry Andric    seed_seq();
4220b57cec5SDimitry Andric    template<class T>
4230b57cec5SDimitry Andric        seed_seq(initializer_list<T> il);
4240b57cec5SDimitry Andric    template<class InputIterator>
4250b57cec5SDimitry Andric        seed_seq(InputIterator begin, InputIterator end);
4260b57cec5SDimitry Andric
4270b57cec5SDimitry Andric    // generating functions
4280b57cec5SDimitry Andric    template<class RandomAccessIterator>
4290b57cec5SDimitry Andric        void generate(RandomAccessIterator begin, RandomAccessIterator end);
4300b57cec5SDimitry Andric
4310b57cec5SDimitry Andric    // property functions
4320b57cec5SDimitry Andric    size_t size() const;
4330b57cec5SDimitry Andric    template<class OutputIterator>
4340b57cec5SDimitry Andric        void param(OutputIterator dest) const;
4350b57cec5SDimitry Andric
4360b57cec5SDimitry Andric    // no copy functions
4370b57cec5SDimitry Andric    seed_seq(const seed_seq&) = delete;
4380b57cec5SDimitry Andric    void operator=(const seed_seq& ) = delete;
4390b57cec5SDimitry Andric};
4400b57cec5SDimitry Andric
4410b57cec5SDimitry Andrictemplate<class RealType, size_t bits, class URNG>
4420b57cec5SDimitry Andric    RealType generate_canonical(URNG& g);
4430b57cec5SDimitry Andric
4440b57cec5SDimitry Andric// Distributions
4450b57cec5SDimitry Andric
4460b57cec5SDimitry Andrictemplate<class IntType = int>
4470b57cec5SDimitry Andricclass uniform_int_distribution
4480b57cec5SDimitry Andric{
4490b57cec5SDimitry Andricpublic:
4500b57cec5SDimitry Andric    // types
4510b57cec5SDimitry Andric    typedef IntType result_type;
4520b57cec5SDimitry Andric
4530b57cec5SDimitry Andric    class param_type
4540b57cec5SDimitry Andric    {
4550b57cec5SDimitry Andric    public:
4560b57cec5SDimitry Andric        typedef uniform_int_distribution distribution_type;
4570b57cec5SDimitry Andric
4580b57cec5SDimitry Andric        explicit param_type(IntType a = 0,
4590b57cec5SDimitry Andric                                    IntType b = numeric_limits<IntType>::max());
4600b57cec5SDimitry Andric
4610b57cec5SDimitry Andric        result_type a() const;
4620b57cec5SDimitry Andric        result_type b() const;
4630b57cec5SDimitry Andric
4640b57cec5SDimitry Andric        friend bool operator==(const param_type& x, const param_type& y);
4650b57cec5SDimitry Andric        friend bool operator!=(const param_type& x, const param_type& y);
4660b57cec5SDimitry Andric    };
4670b57cec5SDimitry Andric
4680b57cec5SDimitry Andric    // constructors and reset functions
4690b57cec5SDimitry Andric    explicit uniform_int_distribution(IntType a = 0,
470e8d8bef9SDimitry Andric                                      IntType b = numeric_limits<IntType>::max()); // before C++20
471e8d8bef9SDimitry Andric    uniform_int_distribution() : uniform_int_distribution(0) {}                    // C++20
472e8d8bef9SDimitry Andric    explicit uniform_int_distribution(IntType a,
473e8d8bef9SDimitry Andric                                      IntType b = numeric_limits<IntType>::max()); // C++20
4740b57cec5SDimitry Andric    explicit uniform_int_distribution(const param_type& parm);
4750b57cec5SDimitry Andric    void reset();
4760b57cec5SDimitry Andric
4770b57cec5SDimitry Andric    // generating functions
4780b57cec5SDimitry Andric    template<class URNG> result_type operator()(URNG& g);
4790b57cec5SDimitry Andric    template<class URNG> result_type operator()(URNG& g, const param_type& parm);
4800b57cec5SDimitry Andric
4810b57cec5SDimitry Andric    // property functions
4820b57cec5SDimitry Andric    result_type a() const;
4830b57cec5SDimitry Andric    result_type b() const;
4840b57cec5SDimitry Andric
4850b57cec5SDimitry Andric    param_type param() const;
4860b57cec5SDimitry Andric    void param(const param_type& parm);
4870b57cec5SDimitry Andric
4880b57cec5SDimitry Andric    result_type min() const;
4890b57cec5SDimitry Andric    result_type max() const;
4900b57cec5SDimitry Andric
4910b57cec5SDimitry Andric    friend bool operator==(const uniform_int_distribution& x,
4920b57cec5SDimitry Andric                           const uniform_int_distribution& y);
4930b57cec5SDimitry Andric    friend bool operator!=(const uniform_int_distribution& x,
4940b57cec5SDimitry Andric                           const uniform_int_distribution& y);
4950b57cec5SDimitry Andric
4960b57cec5SDimitry Andric    template <class charT, class traits>
4970b57cec5SDimitry Andric    friend
4980b57cec5SDimitry Andric    basic_ostream<charT, traits>&
4990b57cec5SDimitry Andric    operator<<(basic_ostream<charT, traits>& os,
5000b57cec5SDimitry Andric               const uniform_int_distribution& x);
5010b57cec5SDimitry Andric
5020b57cec5SDimitry Andric    template <class charT, class traits>
5030b57cec5SDimitry Andric    friend
5040b57cec5SDimitry Andric    basic_istream<charT, traits>&
5050b57cec5SDimitry Andric    operator>>(basic_istream<charT, traits>& is,
5060b57cec5SDimitry Andric               uniform_int_distribution& x);
5070b57cec5SDimitry Andric};
5080b57cec5SDimitry Andric
5090b57cec5SDimitry Andrictemplate<class RealType = double>
5100b57cec5SDimitry Andricclass uniform_real_distribution
5110b57cec5SDimitry Andric{
5120b57cec5SDimitry Andricpublic:
5130b57cec5SDimitry Andric    // types
5140b57cec5SDimitry Andric    typedef RealType result_type;
5150b57cec5SDimitry Andric
5160b57cec5SDimitry Andric    class param_type
5170b57cec5SDimitry Andric    {
5180b57cec5SDimitry Andric    public:
5190b57cec5SDimitry Andric        typedef uniform_real_distribution distribution_type;
5200b57cec5SDimitry Andric
5210b57cec5SDimitry Andric        explicit param_type(RealType a = 0,
5220b57cec5SDimitry Andric                            RealType b = 1);
5230b57cec5SDimitry Andric
5240b57cec5SDimitry Andric        result_type a() const;
5250b57cec5SDimitry Andric        result_type b() const;
5260b57cec5SDimitry Andric
5270b57cec5SDimitry Andric        friend bool operator==(const param_type& x, const param_type& y);
5280b57cec5SDimitry Andric        friend bool operator!=(const param_type& x, const param_type& y);
5290b57cec5SDimitry Andric    };
5300b57cec5SDimitry Andric
5310b57cec5SDimitry Andric    // constructors and reset functions
532e8d8bef9SDimitry Andric    explicit uniform_real_distribution(RealType a = 0.0, RealType b = 1.0); // before C++20
533e8d8bef9SDimitry Andric    uniform_real_distribution() : uniform_real_distribution(0.0) {}         // C++20
534e8d8bef9SDimitry Andric    explicit uniform_real_distribution(RealType a, RealType b = 1.0);       // C++20
5350b57cec5SDimitry Andric    explicit uniform_real_distribution(const param_type& parm);
5360b57cec5SDimitry Andric    void reset();
5370b57cec5SDimitry Andric
5380b57cec5SDimitry Andric    // generating functions
5390b57cec5SDimitry Andric    template<class URNG> result_type operator()(URNG& g);
5400b57cec5SDimitry Andric    template<class URNG> result_type operator()(URNG& g, const param_type& parm);
5410b57cec5SDimitry Andric
5420b57cec5SDimitry Andric    // property functions
5430b57cec5SDimitry Andric    result_type a() const;
5440b57cec5SDimitry Andric    result_type b() const;
5450b57cec5SDimitry Andric
5460b57cec5SDimitry Andric    param_type param() const;
5470b57cec5SDimitry Andric    void param(const param_type& parm);
5480b57cec5SDimitry Andric
5490b57cec5SDimitry Andric    result_type min() const;
5500b57cec5SDimitry Andric    result_type max() const;
5510b57cec5SDimitry Andric
5520b57cec5SDimitry Andric    friend bool operator==(const uniform_real_distribution& x,
5530b57cec5SDimitry Andric                           const uniform_real_distribution& y);
5540b57cec5SDimitry Andric    friend bool operator!=(const uniform_real_distribution& x,
5550b57cec5SDimitry Andric                           const uniform_real_distribution& y);
5560b57cec5SDimitry Andric
5570b57cec5SDimitry Andric    template <class charT, class traits>
5580b57cec5SDimitry Andric    friend
5590b57cec5SDimitry Andric    basic_ostream<charT, traits>&
5600b57cec5SDimitry Andric    operator<<(basic_ostream<charT, traits>& os,
5610b57cec5SDimitry Andric               const uniform_real_distribution& x);
5620b57cec5SDimitry Andric
5630b57cec5SDimitry Andric    template <class charT, class traits>
5640b57cec5SDimitry Andric    friend
5650b57cec5SDimitry Andric    basic_istream<charT, traits>&
5660b57cec5SDimitry Andric    operator>>(basic_istream<charT, traits>& is,
5670b57cec5SDimitry Andric               uniform_real_distribution& x);
5680b57cec5SDimitry Andric};
5690b57cec5SDimitry Andric
5700b57cec5SDimitry Andricclass bernoulli_distribution
5710b57cec5SDimitry Andric{
5720b57cec5SDimitry Andricpublic:
5730b57cec5SDimitry Andric    // types
5740b57cec5SDimitry Andric    typedef bool result_type;
5750b57cec5SDimitry Andric
5760b57cec5SDimitry Andric    class param_type
5770b57cec5SDimitry Andric    {
5780b57cec5SDimitry Andric    public:
5790b57cec5SDimitry Andric        typedef bernoulli_distribution distribution_type;
5800b57cec5SDimitry Andric
5810b57cec5SDimitry Andric        explicit param_type(double p = 0.5);
5820b57cec5SDimitry Andric
5830b57cec5SDimitry Andric        double p() const;
5840b57cec5SDimitry Andric
5850b57cec5SDimitry Andric        friend bool operator==(const param_type& x, const param_type& y);
5860b57cec5SDimitry Andric        friend bool operator!=(const param_type& x, const param_type& y);
5870b57cec5SDimitry Andric    };
5880b57cec5SDimitry Andric
5890b57cec5SDimitry Andric    // constructors and reset functions
590e8d8bef9SDimitry Andric    explicit bernoulli_distribution(double p = 0.5);          // before C++20
591e8d8bef9SDimitry Andric    bernoulli_distribution() : bernoulli_distribution(0.5) {} // C++20
592e8d8bef9SDimitry Andric    explicit bernoulli_distribution(double p);                // C++20
5930b57cec5SDimitry Andric    explicit bernoulli_distribution(const param_type& parm);
5940b57cec5SDimitry Andric    void reset();
5950b57cec5SDimitry Andric
5960b57cec5SDimitry Andric    // generating functions
5970b57cec5SDimitry Andric    template<class URNG> result_type operator()(URNG& g);
5980b57cec5SDimitry Andric    template<class URNG> result_type operator()(URNG& g, const param_type& parm);
5990b57cec5SDimitry Andric
6000b57cec5SDimitry Andric    // property functions
6010b57cec5SDimitry Andric    double p() const;
6020b57cec5SDimitry Andric
6030b57cec5SDimitry Andric    param_type param() const;
6040b57cec5SDimitry Andric    void param(const param_type& parm);
6050b57cec5SDimitry Andric
6060b57cec5SDimitry Andric    result_type min() const;
6070b57cec5SDimitry Andric    result_type max() const;
6080b57cec5SDimitry Andric
6090b57cec5SDimitry Andric    friend bool operator==(const bernoulli_distribution& x,
6100b57cec5SDimitry Andric                           const bernoulli_distribution& y);
6110b57cec5SDimitry Andric    friend bool operator!=(const bernoulli_distribution& x,
6120b57cec5SDimitry Andric                           const bernoulli_distribution& y);
6130b57cec5SDimitry Andric
6140b57cec5SDimitry Andric    template <class charT, class traits>
6150b57cec5SDimitry Andric    friend
6160b57cec5SDimitry Andric    basic_ostream<charT, traits>&
6170b57cec5SDimitry Andric    operator<<(basic_ostream<charT, traits>& os,
6180b57cec5SDimitry Andric               const bernoulli_distribution& x);
6190b57cec5SDimitry Andric
6200b57cec5SDimitry Andric    template <class charT, class traits>
6210b57cec5SDimitry Andric    friend
6220b57cec5SDimitry Andric    basic_istream<charT, traits>&
6230b57cec5SDimitry Andric    operator>>(basic_istream<charT, traits>& is,
6240b57cec5SDimitry Andric               bernoulli_distribution& x);
6250b57cec5SDimitry Andric};
6260b57cec5SDimitry Andric
6270b57cec5SDimitry Andrictemplate<class IntType = int>
6280b57cec5SDimitry Andricclass binomial_distribution
6290b57cec5SDimitry Andric{
6300b57cec5SDimitry Andricpublic:
6310b57cec5SDimitry Andric    // types
6320b57cec5SDimitry Andric    typedef IntType result_type;
6330b57cec5SDimitry Andric
6340b57cec5SDimitry Andric    class param_type
6350b57cec5SDimitry Andric    {
6360b57cec5SDimitry Andric    public:
6370b57cec5SDimitry Andric        typedef binomial_distribution distribution_type;
6380b57cec5SDimitry Andric
6390b57cec5SDimitry Andric        explicit param_type(IntType t = 1, double p = 0.5);
6400b57cec5SDimitry Andric
6410b57cec5SDimitry Andric        IntType t() const;
6420b57cec5SDimitry Andric        double p() const;
6430b57cec5SDimitry Andric
6440b57cec5SDimitry Andric        friend bool operator==(const param_type& x, const param_type& y);
6450b57cec5SDimitry Andric        friend bool operator!=(const param_type& x, const param_type& y);
6460b57cec5SDimitry Andric    };
6470b57cec5SDimitry Andric
6480b57cec5SDimitry Andric    // constructors and reset functions
649e8d8bef9SDimitry Andric    explicit binomial_distribution(IntType t = 1, double p = 0.5); // before C++20
650e8d8bef9SDimitry Andric    binomial_distribution() : binomial_distribution(1) {}          // C++20
651e8d8bef9SDimitry Andric    explicit binomial_distribution(IntType t, double p = 0.5);     // C++20
6520b57cec5SDimitry Andric    explicit binomial_distribution(const param_type& parm);
6530b57cec5SDimitry Andric    void reset();
6540b57cec5SDimitry Andric
6550b57cec5SDimitry Andric    // generating functions
6560b57cec5SDimitry Andric    template<class URNG> result_type operator()(URNG& g);
6570b57cec5SDimitry Andric    template<class URNG> result_type operator()(URNG& g, const param_type& parm);
6580b57cec5SDimitry Andric
6590b57cec5SDimitry Andric    // property functions
6600b57cec5SDimitry Andric    IntType t() const;
6610b57cec5SDimitry Andric    double p() const;
6620b57cec5SDimitry Andric
6630b57cec5SDimitry Andric    param_type param() const;
6640b57cec5SDimitry Andric    void param(const param_type& parm);
6650b57cec5SDimitry Andric
6660b57cec5SDimitry Andric    result_type min() const;
6670b57cec5SDimitry Andric    result_type max() const;
6680b57cec5SDimitry Andric
6690b57cec5SDimitry Andric    friend bool operator==(const binomial_distribution& x,
6700b57cec5SDimitry Andric                           const binomial_distribution& y);
6710b57cec5SDimitry Andric    friend bool operator!=(const binomial_distribution& x,
6720b57cec5SDimitry Andric                           const binomial_distribution& y);
6730b57cec5SDimitry Andric
6740b57cec5SDimitry Andric    template <class charT, class traits>
6750b57cec5SDimitry Andric    friend
6760b57cec5SDimitry Andric    basic_ostream<charT, traits>&
6770b57cec5SDimitry Andric    operator<<(basic_ostream<charT, traits>& os,
6780b57cec5SDimitry Andric               const binomial_distribution& x);
6790b57cec5SDimitry Andric
6800b57cec5SDimitry Andric    template <class charT, class traits>
6810b57cec5SDimitry Andric    friend
6820b57cec5SDimitry Andric    basic_istream<charT, traits>&
6830b57cec5SDimitry Andric    operator>>(basic_istream<charT, traits>& is,
6840b57cec5SDimitry Andric               binomial_distribution& x);
6850b57cec5SDimitry Andric};
6860b57cec5SDimitry Andric
6870b57cec5SDimitry Andrictemplate<class IntType = int>
6880b57cec5SDimitry Andricclass geometric_distribution
6890b57cec5SDimitry Andric{
6900b57cec5SDimitry Andricpublic:
6910b57cec5SDimitry Andric    // types
6920b57cec5SDimitry Andric    typedef IntType result_type;
6930b57cec5SDimitry Andric
6940b57cec5SDimitry Andric    class param_type
6950b57cec5SDimitry Andric    {
6960b57cec5SDimitry Andric    public:
6970b57cec5SDimitry Andric        typedef geometric_distribution distribution_type;
6980b57cec5SDimitry Andric
6990b57cec5SDimitry Andric        explicit param_type(double p = 0.5);
7000b57cec5SDimitry Andric
7010b57cec5SDimitry Andric        double p() const;
7020b57cec5SDimitry Andric
7030b57cec5SDimitry Andric        friend bool operator==(const param_type& x, const param_type& y);
7040b57cec5SDimitry Andric        friend bool operator!=(const param_type& x, const param_type& y);
7050b57cec5SDimitry Andric    };
7060b57cec5SDimitry Andric
7070b57cec5SDimitry Andric    // constructors and reset functions
708e8d8bef9SDimitry Andric    explicit geometric_distribution(double p = 0.5);          // before C++20
709e8d8bef9SDimitry Andric    geometric_distribution() : geometric_distribution(0.5) {} // C++20
710e8d8bef9SDimitry Andric    explicit geometric_distribution(double p);                // C++20
7110b57cec5SDimitry Andric    explicit geometric_distribution(const param_type& parm);
7120b57cec5SDimitry Andric    void reset();
7130b57cec5SDimitry Andric
7140b57cec5SDimitry Andric    // generating functions
7150b57cec5SDimitry Andric    template<class URNG> result_type operator()(URNG& g);
7160b57cec5SDimitry Andric    template<class URNG> result_type operator()(URNG& g, const param_type& parm);
7170b57cec5SDimitry Andric
7180b57cec5SDimitry Andric    // property functions
7190b57cec5SDimitry Andric    double p() const;
7200b57cec5SDimitry Andric
7210b57cec5SDimitry Andric    param_type param() const;
7220b57cec5SDimitry Andric    void param(const param_type& parm);
7230b57cec5SDimitry Andric
7240b57cec5SDimitry Andric    result_type min() const;
7250b57cec5SDimitry Andric    result_type max() const;
7260b57cec5SDimitry Andric
7270b57cec5SDimitry Andric    friend bool operator==(const geometric_distribution& x,
7280b57cec5SDimitry Andric                           const geometric_distribution& y);
7290b57cec5SDimitry Andric    friend bool operator!=(const geometric_distribution& x,
7300b57cec5SDimitry Andric                           const geometric_distribution& y);
7310b57cec5SDimitry Andric
7320b57cec5SDimitry Andric    template <class charT, class traits>
7330b57cec5SDimitry Andric    friend
7340b57cec5SDimitry Andric    basic_ostream<charT, traits>&
7350b57cec5SDimitry Andric    operator<<(basic_ostream<charT, traits>& os,
7360b57cec5SDimitry Andric               const geometric_distribution& x);
7370b57cec5SDimitry Andric
7380b57cec5SDimitry Andric    template <class charT, class traits>
7390b57cec5SDimitry Andric    friend
7400b57cec5SDimitry Andric    basic_istream<charT, traits>&
7410b57cec5SDimitry Andric    operator>>(basic_istream<charT, traits>& is,
7420b57cec5SDimitry Andric               geometric_distribution& x);
7430b57cec5SDimitry Andric};
7440b57cec5SDimitry Andric
7450b57cec5SDimitry Andrictemplate<class IntType = int>
7460b57cec5SDimitry Andricclass negative_binomial_distribution
7470b57cec5SDimitry Andric{
7480b57cec5SDimitry Andricpublic:
7490b57cec5SDimitry Andric    // types
7500b57cec5SDimitry Andric    typedef IntType result_type;
7510b57cec5SDimitry Andric
7520b57cec5SDimitry Andric    class param_type
7530b57cec5SDimitry Andric    {
7540b57cec5SDimitry Andric    public:
7550b57cec5SDimitry Andric        typedef negative_binomial_distribution distribution_type;
7560b57cec5SDimitry Andric
7570b57cec5SDimitry Andric        explicit param_type(result_type k = 1, double p = 0.5);
7580b57cec5SDimitry Andric
7590b57cec5SDimitry Andric        result_type k() const;
7600b57cec5SDimitry Andric        double p() const;
7610b57cec5SDimitry Andric
7620b57cec5SDimitry Andric        friend bool operator==(const param_type& x, const param_type& y);
7630b57cec5SDimitry Andric        friend bool operator!=(const param_type& x, const param_type& y);
7640b57cec5SDimitry Andric    };
7650b57cec5SDimitry Andric
7660b57cec5SDimitry Andric    // constructor and reset functions
767e8d8bef9SDimitry Andric    explicit negative_binomial_distribution(IntType k = 1, double p = 0.5); // before C++20
768e8d8bef9SDimitry Andric    negative_binomial_distribution() : negative_binomial_distribution(1) {} // C++20
769e8d8bef9SDimitry Andric    explicit negative_binomial_distribution(IntType k, double p = 0.5);     // C++20
7700b57cec5SDimitry Andric    explicit negative_binomial_distribution(const param_type& parm);
7710b57cec5SDimitry Andric    void reset();
7720b57cec5SDimitry Andric
7730b57cec5SDimitry Andric    // generating functions
7740b57cec5SDimitry Andric    template<class URNG> result_type operator()(URNG& g);
7750b57cec5SDimitry Andric    template<class URNG> result_type operator()(URNG& g, const param_type& parm);
7760b57cec5SDimitry Andric
7770b57cec5SDimitry Andric    // property functions
7780b57cec5SDimitry Andric    result_type k() const;
7790b57cec5SDimitry Andric    double p() const;
7800b57cec5SDimitry Andric
7810b57cec5SDimitry Andric    param_type param() const;
7820b57cec5SDimitry Andric    void param(const param_type& parm);
7830b57cec5SDimitry Andric
7840b57cec5SDimitry Andric    result_type min() const;
7850b57cec5SDimitry Andric    result_type max() const;
7860b57cec5SDimitry Andric
7870b57cec5SDimitry Andric    friend bool operator==(const negative_binomial_distribution& x,
7880b57cec5SDimitry Andric                           const negative_binomial_distribution& y);
7890b57cec5SDimitry Andric    friend bool operator!=(const negative_binomial_distribution& x,
7900b57cec5SDimitry Andric                           const negative_binomial_distribution& y);
7910b57cec5SDimitry Andric
7920b57cec5SDimitry Andric    template <class charT, class traits>
7930b57cec5SDimitry Andric    friend
7940b57cec5SDimitry Andric    basic_ostream<charT, traits>&
7950b57cec5SDimitry Andric    operator<<(basic_ostream<charT, traits>& os,
7960b57cec5SDimitry Andric               const negative_binomial_distribution& x);
7970b57cec5SDimitry Andric
7980b57cec5SDimitry Andric    template <class charT, class traits>
7990b57cec5SDimitry Andric    friend
8000b57cec5SDimitry Andric    basic_istream<charT, traits>&
8010b57cec5SDimitry Andric    operator>>(basic_istream<charT, traits>& is,
8020b57cec5SDimitry Andric               negative_binomial_distribution& x);
8030b57cec5SDimitry Andric};
8040b57cec5SDimitry Andric
8050b57cec5SDimitry Andrictemplate<class IntType = int>
8060b57cec5SDimitry Andricclass poisson_distribution
8070b57cec5SDimitry Andric{
8080b57cec5SDimitry Andricpublic:
8090b57cec5SDimitry Andric    // types
8100b57cec5SDimitry Andric    typedef IntType result_type;
8110b57cec5SDimitry Andric
8120b57cec5SDimitry Andric    class param_type
8130b57cec5SDimitry Andric    {
8140b57cec5SDimitry Andric    public:
8150b57cec5SDimitry Andric        typedef poisson_distribution distribution_type;
8160b57cec5SDimitry Andric
8170b57cec5SDimitry Andric        explicit param_type(double mean = 1.0);
8180b57cec5SDimitry Andric
8190b57cec5SDimitry Andric        double mean() const;
8200b57cec5SDimitry Andric
8210b57cec5SDimitry Andric        friend bool operator==(const param_type& x, const param_type& y);
8220b57cec5SDimitry Andric        friend bool operator!=(const param_type& x, const param_type& y);
8230b57cec5SDimitry Andric    };
8240b57cec5SDimitry Andric
8250b57cec5SDimitry Andric    // constructors and reset functions
826e8d8bef9SDimitry Andric    explicit poisson_distribution(double mean = 1.0);     // before C++20
827e8d8bef9SDimitry Andric    poisson_distribution() : poisson_distribution(1.0) {} // C++20
828e8d8bef9SDimitry Andric    explicit poisson_distribution(double mean);           // C++20
8290b57cec5SDimitry Andric    explicit poisson_distribution(const param_type& parm);
8300b57cec5SDimitry Andric    void reset();
8310b57cec5SDimitry Andric
8320b57cec5SDimitry Andric    // generating functions
8330b57cec5SDimitry Andric    template<class URNG> result_type operator()(URNG& g);
8340b57cec5SDimitry Andric    template<class URNG> result_type operator()(URNG& g, const param_type& parm);
8350b57cec5SDimitry Andric
8360b57cec5SDimitry Andric    // property functions
8370b57cec5SDimitry Andric    double mean() const;
8380b57cec5SDimitry Andric
8390b57cec5SDimitry Andric    param_type param() const;
8400b57cec5SDimitry Andric    void param(const param_type& parm);
8410b57cec5SDimitry Andric
8420b57cec5SDimitry Andric    result_type min() const;
8430b57cec5SDimitry Andric    result_type max() const;
8440b57cec5SDimitry Andric
8450b57cec5SDimitry Andric    friend bool operator==(const poisson_distribution& x,
8460b57cec5SDimitry Andric                           const poisson_distribution& y);
8470b57cec5SDimitry Andric    friend bool operator!=(const poisson_distribution& x,
8480b57cec5SDimitry Andric                           const poisson_distribution& y);
8490b57cec5SDimitry Andric
8500b57cec5SDimitry Andric    template <class charT, class traits>
8510b57cec5SDimitry Andric    friend
8520b57cec5SDimitry Andric    basic_ostream<charT, traits>&
8530b57cec5SDimitry Andric    operator<<(basic_ostream<charT, traits>& os,
8540b57cec5SDimitry Andric               const poisson_distribution& x);
8550b57cec5SDimitry Andric
8560b57cec5SDimitry Andric    template <class charT, class traits>
8570b57cec5SDimitry Andric    friend
8580b57cec5SDimitry Andric    basic_istream<charT, traits>&
8590b57cec5SDimitry Andric    operator>>(basic_istream<charT, traits>& is,
8600b57cec5SDimitry Andric               poisson_distribution& x);
8610b57cec5SDimitry Andric};
8620b57cec5SDimitry Andric
8630b57cec5SDimitry Andrictemplate<class RealType = double>
8640b57cec5SDimitry Andricclass exponential_distribution
8650b57cec5SDimitry Andric{
8660b57cec5SDimitry Andricpublic:
8670b57cec5SDimitry Andric    // types
8680b57cec5SDimitry Andric    typedef RealType result_type;
8690b57cec5SDimitry Andric
8700b57cec5SDimitry Andric    class param_type
8710b57cec5SDimitry Andric    {
8720b57cec5SDimitry Andric    public:
8730b57cec5SDimitry Andric        typedef exponential_distribution distribution_type;
8740b57cec5SDimitry Andric
8750b57cec5SDimitry Andric        explicit param_type(result_type lambda = 1.0);
8760b57cec5SDimitry Andric
8770b57cec5SDimitry Andric        result_type lambda() const;
8780b57cec5SDimitry Andric
8790b57cec5SDimitry Andric        friend bool operator==(const param_type& x, const param_type& y);
8800b57cec5SDimitry Andric        friend bool operator!=(const param_type& x, const param_type& y);
8810b57cec5SDimitry Andric    };
8820b57cec5SDimitry Andric
8830b57cec5SDimitry Andric    // constructors and reset functions
884e8d8bef9SDimitry Andric    explicit exponential_distribution(RealType lambda = 1.0);     // before C++20
885e8d8bef9SDimitry Andric    exponential_distribution() : exponential_distribution(1.0) {} // C++20
886e8d8bef9SDimitry Andric    explicit exponential_distribution(RealType lambda);           // C++20
8870b57cec5SDimitry Andric    explicit exponential_distribution(const param_type& parm);
8880b57cec5SDimitry Andric    void reset();
8890b57cec5SDimitry Andric
8900b57cec5SDimitry Andric    // generating functions
8910b57cec5SDimitry Andric    template<class URNG> result_type operator()(URNG& g);
8920b57cec5SDimitry Andric    template<class URNG> result_type operator()(URNG& g, const param_type& parm);
8930b57cec5SDimitry Andric
8940b57cec5SDimitry Andric    // property functions
8950b57cec5SDimitry Andric    result_type lambda() const;
8960b57cec5SDimitry Andric
8970b57cec5SDimitry Andric    param_type param() const;
8980b57cec5SDimitry Andric    void param(const param_type& parm);
8990b57cec5SDimitry Andric
9000b57cec5SDimitry Andric    result_type min() const;
9010b57cec5SDimitry Andric    result_type max() const;
9020b57cec5SDimitry Andric
9030b57cec5SDimitry Andric    friend bool operator==(const exponential_distribution& x,
9040b57cec5SDimitry Andric                           const exponential_distribution& y);
9050b57cec5SDimitry Andric    friend bool operator!=(const exponential_distribution& x,
9060b57cec5SDimitry Andric                           const exponential_distribution& y);
9070b57cec5SDimitry Andric
9080b57cec5SDimitry Andric    template <class charT, class traits>
9090b57cec5SDimitry Andric    friend
9100b57cec5SDimitry Andric    basic_ostream<charT, traits>&
9110b57cec5SDimitry Andric    operator<<(basic_ostream<charT, traits>& os,
9120b57cec5SDimitry Andric               const exponential_distribution& x);
9130b57cec5SDimitry Andric
9140b57cec5SDimitry Andric    template <class charT, class traits>
9150b57cec5SDimitry Andric    friend
9160b57cec5SDimitry Andric    basic_istream<charT, traits>&
9170b57cec5SDimitry Andric    operator>>(basic_istream<charT, traits>& is,
9180b57cec5SDimitry Andric               exponential_distribution& x);
9190b57cec5SDimitry Andric};
9200b57cec5SDimitry Andric
9210b57cec5SDimitry Andrictemplate<class RealType = double>
9220b57cec5SDimitry Andricclass gamma_distribution
9230b57cec5SDimitry Andric{
9240b57cec5SDimitry Andricpublic:
9250b57cec5SDimitry Andric    // types
9260b57cec5SDimitry Andric    typedef RealType result_type;
9270b57cec5SDimitry Andric
9280b57cec5SDimitry Andric    class param_type
9290b57cec5SDimitry Andric    {
9300b57cec5SDimitry Andric    public:
9310b57cec5SDimitry Andric        typedef gamma_distribution distribution_type;
9320b57cec5SDimitry Andric
9330b57cec5SDimitry Andric        explicit param_type(result_type alpha = 1, result_type beta = 1);
9340b57cec5SDimitry Andric
9350b57cec5SDimitry Andric        result_type alpha() const;
9360b57cec5SDimitry Andric        result_type beta() const;
9370b57cec5SDimitry Andric
9380b57cec5SDimitry Andric        friend bool operator==(const param_type& x, const param_type& y);
9390b57cec5SDimitry Andric        friend bool operator!=(const param_type& x, const param_type& y);
9400b57cec5SDimitry Andric    };
9410b57cec5SDimitry Andric
9420b57cec5SDimitry Andric    // constructors and reset functions
943e8d8bef9SDimitry Andric    explicit gamma_distribution(RealType alpha = 0.0, RealType beta = 1.0); // before C++20
944e8d8bef9SDimitry Andric    gamma_distribution() : gamma_distribution(0.0) {}                       // C++20
945e8d8bef9SDimitry Andric    explicit gamma_distribution(RealType alpha, RealType beta = 1.0);       // C++20
9460b57cec5SDimitry Andric    explicit gamma_distribution(const param_type& parm);
9470b57cec5SDimitry Andric    void reset();
9480b57cec5SDimitry Andric
9490b57cec5SDimitry Andric    // generating functions
9500b57cec5SDimitry Andric    template<class URNG> result_type operator()(URNG& g);
9510b57cec5SDimitry Andric    template<class URNG> result_type operator()(URNG& g, const param_type& parm);
9520b57cec5SDimitry Andric
9530b57cec5SDimitry Andric    // property functions
9540b57cec5SDimitry Andric    result_type alpha() const;
9550b57cec5SDimitry Andric    result_type beta() const;
9560b57cec5SDimitry Andric
9570b57cec5SDimitry Andric    param_type param() const;
9580b57cec5SDimitry Andric    void param(const param_type& parm);
9590b57cec5SDimitry Andric
9600b57cec5SDimitry Andric    result_type min() const;
9610b57cec5SDimitry Andric    result_type max() const;
9620b57cec5SDimitry Andric
9630b57cec5SDimitry Andric    friend bool operator==(const gamma_distribution& x,
9640b57cec5SDimitry Andric                           const gamma_distribution& y);
9650b57cec5SDimitry Andric    friend bool operator!=(const gamma_distribution& x,
9660b57cec5SDimitry Andric                           const gamma_distribution& y);
9670b57cec5SDimitry Andric
9680b57cec5SDimitry Andric    template <class charT, class traits>
9690b57cec5SDimitry Andric    friend
9700b57cec5SDimitry Andric    basic_ostream<charT, traits>&
9710b57cec5SDimitry Andric    operator<<(basic_ostream<charT, traits>& os,
9720b57cec5SDimitry Andric               const gamma_distribution& x);
9730b57cec5SDimitry Andric
9740b57cec5SDimitry Andric    template <class charT, class traits>
9750b57cec5SDimitry Andric    friend
9760b57cec5SDimitry Andric    basic_istream<charT, traits>&
9770b57cec5SDimitry Andric    operator>>(basic_istream<charT, traits>& is,
9780b57cec5SDimitry Andric               gamma_distribution& x);
9790b57cec5SDimitry Andric};
9800b57cec5SDimitry Andric
9810b57cec5SDimitry Andrictemplate<class RealType = double>
9820b57cec5SDimitry Andricclass weibull_distribution
9830b57cec5SDimitry Andric{
9840b57cec5SDimitry Andricpublic:
9850b57cec5SDimitry Andric    // types
9860b57cec5SDimitry Andric    typedef RealType result_type;
9870b57cec5SDimitry Andric
9880b57cec5SDimitry Andric    class param_type
9890b57cec5SDimitry Andric    {
9900b57cec5SDimitry Andric    public:
9910b57cec5SDimitry Andric        typedef weibull_distribution distribution_type;
9920b57cec5SDimitry Andric
9930b57cec5SDimitry Andric        explicit param_type(result_type alpha = 1, result_type beta = 1);
9940b57cec5SDimitry Andric
9950b57cec5SDimitry Andric        result_type a() const;
9960b57cec5SDimitry Andric        result_type b() const;
9970b57cec5SDimitry Andric
9980b57cec5SDimitry Andric        friend bool operator==(const param_type& x, const param_type& y);
9990b57cec5SDimitry Andric        friend bool operator!=(const param_type& x, const param_type& y);
10000b57cec5SDimitry Andric    };
10010b57cec5SDimitry Andric
10020b57cec5SDimitry Andric    // constructor and reset functions
1003e8d8bef9SDimitry Andric    explicit weibull_distribution(RealType a = 1.0, RealType b = 1.0); // before C++20
1004e8d8bef9SDimitry Andric    weibull_distribution() : weibull_distribution(1.0) {}              // C++20
1005e8d8bef9SDimitry Andric    explicit weibull_distribution(RealType a, RealType b = 1.0);       // C++20
10060b57cec5SDimitry Andric    explicit weibull_distribution(const param_type& parm);
10070b57cec5SDimitry Andric    void reset();
10080b57cec5SDimitry Andric
10090b57cec5SDimitry Andric    // generating functions
10100b57cec5SDimitry Andric    template<class URNG> result_type operator()(URNG& g);
10110b57cec5SDimitry Andric    template<class URNG> result_type operator()(URNG& g, const param_type& parm);
10120b57cec5SDimitry Andric
10130b57cec5SDimitry Andric    // property functions
10140b57cec5SDimitry Andric    result_type a() const;
10150b57cec5SDimitry Andric    result_type b() const;
10160b57cec5SDimitry Andric
10170b57cec5SDimitry Andric    param_type param() const;
10180b57cec5SDimitry Andric    void param(const param_type& parm);
10190b57cec5SDimitry Andric
10200b57cec5SDimitry Andric    result_type min() const;
10210b57cec5SDimitry Andric    result_type max() const;
10220b57cec5SDimitry Andric
10230b57cec5SDimitry Andric    friend bool operator==(const weibull_distribution& x,
10240b57cec5SDimitry Andric                           const weibull_distribution& y);
10250b57cec5SDimitry Andric    friend bool operator!=(const weibull_distribution& x,
10260b57cec5SDimitry Andric                           const weibull_distribution& y);
10270b57cec5SDimitry Andric
10280b57cec5SDimitry Andric    template <class charT, class traits>
10290b57cec5SDimitry Andric    friend
10300b57cec5SDimitry Andric    basic_ostream<charT, traits>&
10310b57cec5SDimitry Andric    operator<<(basic_ostream<charT, traits>& os,
10320b57cec5SDimitry Andric               const weibull_distribution& x);
10330b57cec5SDimitry Andric
10340b57cec5SDimitry Andric    template <class charT, class traits>
10350b57cec5SDimitry Andric    friend
10360b57cec5SDimitry Andric    basic_istream<charT, traits>&
10370b57cec5SDimitry Andric    operator>>(basic_istream<charT, traits>& is,
10380b57cec5SDimitry Andric               weibull_distribution& x);
10390b57cec5SDimitry Andric};
10400b57cec5SDimitry Andric
10410b57cec5SDimitry Andrictemplate<class RealType = double>
10420b57cec5SDimitry Andricclass extreme_value_distribution
10430b57cec5SDimitry Andric{
10440b57cec5SDimitry Andricpublic:
10450b57cec5SDimitry Andric    // types
10460b57cec5SDimitry Andric    typedef RealType result_type;
10470b57cec5SDimitry Andric
10480b57cec5SDimitry Andric    class param_type
10490b57cec5SDimitry Andric    {
10500b57cec5SDimitry Andric    public:
10510b57cec5SDimitry Andric        typedef extreme_value_distribution distribution_type;
10520b57cec5SDimitry Andric
10530b57cec5SDimitry Andric        explicit param_type(result_type a = 0, result_type b = 1);
10540b57cec5SDimitry Andric
10550b57cec5SDimitry Andric        result_type a() const;
10560b57cec5SDimitry Andric        result_type b() const;
10570b57cec5SDimitry Andric
10580b57cec5SDimitry Andric        friend bool operator==(const param_type& x, const param_type& y);
10590b57cec5SDimitry Andric        friend bool operator!=(const param_type& x, const param_type& y);
10600b57cec5SDimitry Andric    };
10610b57cec5SDimitry Andric
10620b57cec5SDimitry Andric    // constructor and reset functions
1063e8d8bef9SDimitry Andric    explicit extreme_value_distribution(RealType a = 0.0, RealType b = 1.0); // before C++20
1064e8d8bef9SDimitry Andric    extreme_value_distribution() : extreme_value_distribution(0.0) {}        // C++20
1065e8d8bef9SDimitry Andric    explicit extreme_value_distribution(RealType a, RealType b = 1.0);       // C++20
10660b57cec5SDimitry Andric    explicit extreme_value_distribution(const param_type& parm);
10670b57cec5SDimitry Andric    void reset();
10680b57cec5SDimitry Andric
10690b57cec5SDimitry Andric    // generating functions
10700b57cec5SDimitry Andric    template<class URNG> result_type operator()(URNG& g);
10710b57cec5SDimitry Andric    template<class URNG> result_type operator()(URNG& g, const param_type& parm);
10720b57cec5SDimitry Andric
10730b57cec5SDimitry Andric    // property functions
10740b57cec5SDimitry Andric    result_type a() const;
10750b57cec5SDimitry Andric    result_type b() const;
10760b57cec5SDimitry Andric
10770b57cec5SDimitry Andric    param_type param() const;
10780b57cec5SDimitry Andric    void param(const param_type& parm);
10790b57cec5SDimitry Andric
10800b57cec5SDimitry Andric    result_type min() const;
10810b57cec5SDimitry Andric    result_type max() const;
10820b57cec5SDimitry Andric
10830b57cec5SDimitry Andric    friend bool operator==(const extreme_value_distribution& x,
10840b57cec5SDimitry Andric                           const extreme_value_distribution& y);
10850b57cec5SDimitry Andric    friend bool operator!=(const extreme_value_distribution& x,
10860b57cec5SDimitry Andric                           const extreme_value_distribution& y);
10870b57cec5SDimitry Andric
10880b57cec5SDimitry Andric    template <class charT, class traits>
10890b57cec5SDimitry Andric    friend
10900b57cec5SDimitry Andric    basic_ostream<charT, traits>&
10910b57cec5SDimitry Andric    operator<<(basic_ostream<charT, traits>& os,
10920b57cec5SDimitry Andric               const extreme_value_distribution& x);
10930b57cec5SDimitry Andric
10940b57cec5SDimitry Andric    template <class charT, class traits>
10950b57cec5SDimitry Andric    friend
10960b57cec5SDimitry Andric    basic_istream<charT, traits>&
10970b57cec5SDimitry Andric    operator>>(basic_istream<charT, traits>& is,
10980b57cec5SDimitry Andric               extreme_value_distribution& x);
10990b57cec5SDimitry Andric};
11000b57cec5SDimitry Andric
11010b57cec5SDimitry Andrictemplate<class RealType = double>
11020b57cec5SDimitry Andricclass normal_distribution
11030b57cec5SDimitry Andric{
11040b57cec5SDimitry Andricpublic:
11050b57cec5SDimitry Andric    // types
11060b57cec5SDimitry Andric    typedef RealType result_type;
11070b57cec5SDimitry Andric
11080b57cec5SDimitry Andric    class param_type
11090b57cec5SDimitry Andric    {
11100b57cec5SDimitry Andric    public:
11110b57cec5SDimitry Andric        typedef normal_distribution distribution_type;
11120b57cec5SDimitry Andric
11130b57cec5SDimitry Andric        explicit param_type(result_type mean = 0, result_type stddev = 1);
11140b57cec5SDimitry Andric
11150b57cec5SDimitry Andric        result_type mean() const;
11160b57cec5SDimitry Andric        result_type stddev() const;
11170b57cec5SDimitry Andric
11180b57cec5SDimitry Andric        friend bool operator==(const param_type& x, const param_type& y);
11190b57cec5SDimitry Andric        friend bool operator!=(const param_type& x, const param_type& y);
11200b57cec5SDimitry Andric    };
11210b57cec5SDimitry Andric
11220b57cec5SDimitry Andric    // constructors and reset functions
1123e8d8bef9SDimitry Andric    explicit normal_distribution(RealType mean = 0.0, RealType stddev = 1.0); // before C++20
1124e8d8bef9SDimitry Andric    normal_distribution() : normal_distribution(0.0) {}                       // C++20
1125e8d8bef9SDimitry Andric    explicit normal_distribution(RealType mean, RealType stddev = 1.0);       // C++20
11260b57cec5SDimitry Andric    explicit normal_distribution(const param_type& parm);
11270b57cec5SDimitry Andric    void reset();
11280b57cec5SDimitry Andric
11290b57cec5SDimitry Andric    // generating functions
11300b57cec5SDimitry Andric    template<class URNG> result_type operator()(URNG& g);
11310b57cec5SDimitry Andric    template<class URNG> result_type operator()(URNG& g, const param_type& parm);
11320b57cec5SDimitry Andric
11330b57cec5SDimitry Andric    // property functions
11340b57cec5SDimitry Andric    result_type mean() const;
11350b57cec5SDimitry Andric    result_type stddev() const;
11360b57cec5SDimitry Andric
11370b57cec5SDimitry Andric    param_type param() const;
11380b57cec5SDimitry Andric    void param(const param_type& parm);
11390b57cec5SDimitry Andric
11400b57cec5SDimitry Andric    result_type min() const;
11410b57cec5SDimitry Andric    result_type max() const;
11420b57cec5SDimitry Andric
11430b57cec5SDimitry Andric    friend bool operator==(const normal_distribution& x,
11440b57cec5SDimitry Andric                           const normal_distribution& y);
11450b57cec5SDimitry Andric    friend bool operator!=(const normal_distribution& x,
11460b57cec5SDimitry Andric                           const normal_distribution& y);
11470b57cec5SDimitry Andric
11480b57cec5SDimitry Andric    template <class charT, class traits>
11490b57cec5SDimitry Andric    friend
11500b57cec5SDimitry Andric    basic_ostream<charT, traits>&
11510b57cec5SDimitry Andric    operator<<(basic_ostream<charT, traits>& os,
11520b57cec5SDimitry Andric               const normal_distribution& x);
11530b57cec5SDimitry Andric
11540b57cec5SDimitry Andric    template <class charT, class traits>
11550b57cec5SDimitry Andric    friend
11560b57cec5SDimitry Andric    basic_istream<charT, traits>&
11570b57cec5SDimitry Andric    operator>>(basic_istream<charT, traits>& is,
11580b57cec5SDimitry Andric               normal_distribution& x);
11590b57cec5SDimitry Andric};
11600b57cec5SDimitry Andric
11610b57cec5SDimitry Andrictemplate<class RealType = double>
11620b57cec5SDimitry Andricclass lognormal_distribution
11630b57cec5SDimitry Andric{
11640b57cec5SDimitry Andricpublic:
11650b57cec5SDimitry Andric    // types
11660b57cec5SDimitry Andric    typedef RealType result_type;
11670b57cec5SDimitry Andric
11680b57cec5SDimitry Andric    class param_type
11690b57cec5SDimitry Andric    {
11700b57cec5SDimitry Andric    public:
11710b57cec5SDimitry Andric        typedef lognormal_distribution distribution_type;
11720b57cec5SDimitry Andric
11730b57cec5SDimitry Andric        explicit param_type(result_type m = 0, result_type s = 1);
11740b57cec5SDimitry Andric
11750b57cec5SDimitry Andric        result_type m() const;
11760b57cec5SDimitry Andric        result_type s() const;
11770b57cec5SDimitry Andric
11780b57cec5SDimitry Andric        friend bool operator==(const param_type& x, const param_type& y);
11790b57cec5SDimitry Andric        friend bool operator!=(const param_type& x, const param_type& y);
11800b57cec5SDimitry Andric    };
11810b57cec5SDimitry Andric
11820b57cec5SDimitry Andric    // constructor and reset functions
1183e8d8bef9SDimitry Andric    explicit lognormal_distribution(RealType mean = 0.0, RealType stddev = 1.0); // before C++20
1184e8d8bef9SDimitry Andric    lognormal_distribution() : lognormal_distribution(0.0) {}                    // C++20
1185e8d8bef9SDimitry Andric    explicit lognormal_distribution(RealType mean, RealType stddev = 1.0);       // C++20
11860b57cec5SDimitry Andric    explicit lognormal_distribution(const param_type& parm);
11870b57cec5SDimitry Andric    void reset();
11880b57cec5SDimitry Andric
11890b57cec5SDimitry Andric    // generating functions
11900b57cec5SDimitry Andric    template<class URNG> result_type operator()(URNG& g);
11910b57cec5SDimitry Andric    template<class URNG> result_type operator()(URNG& g, const param_type& parm);
11920b57cec5SDimitry Andric
11930b57cec5SDimitry Andric    // property functions
11940b57cec5SDimitry Andric    result_type m() const;
11950b57cec5SDimitry Andric    result_type s() const;
11960b57cec5SDimitry Andric
11970b57cec5SDimitry Andric    param_type param() const;
11980b57cec5SDimitry Andric    void param(const param_type& parm);
11990b57cec5SDimitry Andric
12000b57cec5SDimitry Andric    result_type min() const;
12010b57cec5SDimitry Andric    result_type max() const;
12020b57cec5SDimitry Andric
12030b57cec5SDimitry Andric    friend bool operator==(const lognormal_distribution& x,
12040b57cec5SDimitry Andric                           const lognormal_distribution& y);
12050b57cec5SDimitry Andric    friend bool operator!=(const lognormal_distribution& x,
12060b57cec5SDimitry Andric                           const lognormal_distribution& y);
12070b57cec5SDimitry Andric
12080b57cec5SDimitry Andric    template <class charT, class traits>
12090b57cec5SDimitry Andric    friend
12100b57cec5SDimitry Andric    basic_ostream<charT, traits>&
12110b57cec5SDimitry Andric    operator<<(basic_ostream<charT, traits>& os,
12120b57cec5SDimitry Andric               const lognormal_distribution& x);
12130b57cec5SDimitry Andric
12140b57cec5SDimitry Andric    template <class charT, class traits>
12150b57cec5SDimitry Andric    friend
12160b57cec5SDimitry Andric    basic_istream<charT, traits>&
12170b57cec5SDimitry Andric    operator>>(basic_istream<charT, traits>& is,
12180b57cec5SDimitry Andric               lognormal_distribution& x);
12190b57cec5SDimitry Andric};
12200b57cec5SDimitry Andric
12210b57cec5SDimitry Andrictemplate<class RealType = double>
12220b57cec5SDimitry Andricclass chi_squared_distribution
12230b57cec5SDimitry Andric{
12240b57cec5SDimitry Andricpublic:
12250b57cec5SDimitry Andric    // types
12260b57cec5SDimitry Andric    typedef RealType result_type;
12270b57cec5SDimitry Andric
12280b57cec5SDimitry Andric    class param_type
12290b57cec5SDimitry Andric    {
12300b57cec5SDimitry Andric    public:
12310b57cec5SDimitry Andric        typedef chi_squared_distribution distribution_type;
12320b57cec5SDimitry Andric
12330b57cec5SDimitry Andric        explicit param_type(result_type n = 1);
12340b57cec5SDimitry Andric
12350b57cec5SDimitry Andric        result_type n() const;
12360b57cec5SDimitry Andric
12370b57cec5SDimitry Andric        friend bool operator==(const param_type& x, const param_type& y);
12380b57cec5SDimitry Andric        friend bool operator!=(const param_type& x, const param_type& y);
12390b57cec5SDimitry Andric    };
12400b57cec5SDimitry Andric
12410b57cec5SDimitry Andric    // constructor and reset functions
1242e8d8bef9SDimitry Andric    explicit chi_squared_distribution(RealType n = 1.0);          // before C++20
1243e8d8bef9SDimitry Andric    chi_squared_distribution() : chi_squared_distribution(1.0) {} // C++20
1244e8d8bef9SDimitry Andric    explicit chi_squared_distribution(RealType n);                // C++20
12450b57cec5SDimitry Andric    explicit chi_squared_distribution(const param_type& parm);
12460b57cec5SDimitry Andric    void reset();
12470b57cec5SDimitry Andric
12480b57cec5SDimitry Andric    // generating functions
12490b57cec5SDimitry Andric    template<class URNG> result_type operator()(URNG& g);
12500b57cec5SDimitry Andric    template<class URNG> result_type operator()(URNG& g, const param_type& parm);
12510b57cec5SDimitry Andric
12520b57cec5SDimitry Andric    // property functions
12530b57cec5SDimitry Andric    result_type n() const;
12540b57cec5SDimitry Andric
12550b57cec5SDimitry Andric    param_type param() const;
12560b57cec5SDimitry Andric    void param(const param_type& parm);
12570b57cec5SDimitry Andric
12580b57cec5SDimitry Andric    result_type min() const;
12590b57cec5SDimitry Andric    result_type max() const;
12600b57cec5SDimitry Andric
12610b57cec5SDimitry Andric    friend bool operator==(const chi_squared_distribution& x,
12620b57cec5SDimitry Andric                           const chi_squared_distribution& y);
12630b57cec5SDimitry Andric    friend bool operator!=(const chi_squared_distribution& x,
12640b57cec5SDimitry Andric                           const chi_squared_distribution& y);
12650b57cec5SDimitry Andric
12660b57cec5SDimitry Andric    template <class charT, class traits>
12670b57cec5SDimitry Andric    friend
12680b57cec5SDimitry Andric    basic_ostream<charT, traits>&
12690b57cec5SDimitry Andric    operator<<(basic_ostream<charT, traits>& os,
12700b57cec5SDimitry Andric               const chi_squared_distribution& x);
12710b57cec5SDimitry Andric
12720b57cec5SDimitry Andric    template <class charT, class traits>
12730b57cec5SDimitry Andric    friend
12740b57cec5SDimitry Andric    basic_istream<charT, traits>&
12750b57cec5SDimitry Andric    operator>>(basic_istream<charT, traits>& is,
12760b57cec5SDimitry Andric               chi_squared_distribution& x);
12770b57cec5SDimitry Andric};
12780b57cec5SDimitry Andric
12790b57cec5SDimitry Andrictemplate<class RealType = double>
12800b57cec5SDimitry Andricclass cauchy_distribution
12810b57cec5SDimitry Andric{
12820b57cec5SDimitry Andricpublic:
12830b57cec5SDimitry Andric    // types
12840b57cec5SDimitry Andric    typedef RealType result_type;
12850b57cec5SDimitry Andric
12860b57cec5SDimitry Andric    class param_type
12870b57cec5SDimitry Andric    {
12880b57cec5SDimitry Andric    public:
12890b57cec5SDimitry Andric        typedef cauchy_distribution distribution_type;
12900b57cec5SDimitry Andric
12910b57cec5SDimitry Andric        explicit param_type(result_type a = 0, result_type b = 1);
12920b57cec5SDimitry Andric
12930b57cec5SDimitry Andric        result_type a() const;
12940b57cec5SDimitry Andric        result_type b() const;
12950b57cec5SDimitry Andric
12960b57cec5SDimitry Andric        friend bool operator==(const param_type& x, const param_type& y);
12970b57cec5SDimitry Andric        friend bool operator!=(const param_type& x, const param_type& y);
12980b57cec5SDimitry Andric    };
12990b57cec5SDimitry Andric
13000b57cec5SDimitry Andric    // constructor and reset functions
1301e8d8bef9SDimitry Andric    explicit cauchy_distribution(RealType a = 0.0, RealType b = 1.0); // before C++20
1302e8d8bef9SDimitry Andric    cauchy_distribution() : cauchy_distribution(0.0) {}               // C++20
1303e8d8bef9SDimitry Andric    explicit cauchy_distribution(RealType a, RealType b = 1.0);       // C++20
13040b57cec5SDimitry Andric    explicit cauchy_distribution(const param_type& parm);
13050b57cec5SDimitry Andric    void reset();
13060b57cec5SDimitry Andric
13070b57cec5SDimitry Andric    // generating functions
13080b57cec5SDimitry Andric    template<class URNG> result_type operator()(URNG& g);
13090b57cec5SDimitry Andric    template<class URNG> result_type operator()(URNG& g, const param_type& parm);
13100b57cec5SDimitry Andric
13110b57cec5SDimitry Andric    // property functions
13120b57cec5SDimitry Andric    result_type a() const;
13130b57cec5SDimitry Andric    result_type b() const;
13140b57cec5SDimitry Andric
13150b57cec5SDimitry Andric    param_type param() const;
13160b57cec5SDimitry Andric    void param(const param_type& parm);
13170b57cec5SDimitry Andric
13180b57cec5SDimitry Andric    result_type min() const;
13190b57cec5SDimitry Andric    result_type max() const;
13200b57cec5SDimitry Andric
13210b57cec5SDimitry Andric    friend bool operator==(const cauchy_distribution& x,
13220b57cec5SDimitry Andric                           const cauchy_distribution& y);
13230b57cec5SDimitry Andric    friend bool operator!=(const cauchy_distribution& x,
13240b57cec5SDimitry Andric                           const cauchy_distribution& y);
13250b57cec5SDimitry Andric
13260b57cec5SDimitry Andric    template <class charT, class traits>
13270b57cec5SDimitry Andric    friend
13280b57cec5SDimitry Andric    basic_ostream<charT, traits>&
13290b57cec5SDimitry Andric    operator<<(basic_ostream<charT, traits>& os,
13300b57cec5SDimitry Andric               const cauchy_distribution& x);
13310b57cec5SDimitry Andric
13320b57cec5SDimitry Andric    template <class charT, class traits>
13330b57cec5SDimitry Andric    friend
13340b57cec5SDimitry Andric    basic_istream<charT, traits>&
13350b57cec5SDimitry Andric    operator>>(basic_istream<charT, traits>& is,
13360b57cec5SDimitry Andric               cauchy_distribution& x);
13370b57cec5SDimitry Andric};
13380b57cec5SDimitry Andric
13390b57cec5SDimitry Andrictemplate<class RealType = double>
13400b57cec5SDimitry Andricclass fisher_f_distribution
13410b57cec5SDimitry Andric{
13420b57cec5SDimitry Andricpublic:
13430b57cec5SDimitry Andric    // types
13440b57cec5SDimitry Andric    typedef RealType result_type;
13450b57cec5SDimitry Andric
13460b57cec5SDimitry Andric    class param_type
13470b57cec5SDimitry Andric    {
13480b57cec5SDimitry Andric    public:
13490b57cec5SDimitry Andric        typedef fisher_f_distribution distribution_type;
13500b57cec5SDimitry Andric
13510b57cec5SDimitry Andric        explicit param_type(result_type m = 1, result_type n = 1);
13520b57cec5SDimitry Andric
13530b57cec5SDimitry Andric        result_type m() const;
13540b57cec5SDimitry Andric        result_type n() const;
13550b57cec5SDimitry Andric
13560b57cec5SDimitry Andric        friend bool operator==(const param_type& x, const param_type& y);
13570b57cec5SDimitry Andric        friend bool operator!=(const param_type& x, const param_type& y);
13580b57cec5SDimitry Andric    };
13590b57cec5SDimitry Andric
13600b57cec5SDimitry Andric    // constructor and reset functions
1361e8d8bef9SDimitry Andric    explicit fisher_f_distribution(RealType m = 1.0, RealType n = 1.0); // before C++20
1362e8d8bef9SDimitry Andric    fisher_f_distribution() : fisher_f_distribution(1.0) {}             // C++20
1363e8d8bef9SDimitry Andric    explicit fisher_f_distribution(RealType m, RealType n = 1.0);       // C++20
13640b57cec5SDimitry Andric    explicit fisher_f_distribution(const param_type& parm);
13650b57cec5SDimitry Andric    void reset();
13660b57cec5SDimitry Andric
13670b57cec5SDimitry Andric    // generating functions
13680b57cec5SDimitry Andric    template<class URNG> result_type operator()(URNG& g);
13690b57cec5SDimitry Andric    template<class URNG> result_type operator()(URNG& g, const param_type& parm);
13700b57cec5SDimitry Andric
13710b57cec5SDimitry Andric    // property functions
13720b57cec5SDimitry Andric    result_type m() const;
13730b57cec5SDimitry Andric    result_type n() const;
13740b57cec5SDimitry Andric
13750b57cec5SDimitry Andric    param_type param() const;
13760b57cec5SDimitry Andric    void param(const param_type& parm);
13770b57cec5SDimitry Andric
13780b57cec5SDimitry Andric    result_type min() const;
13790b57cec5SDimitry Andric    result_type max() const;
13800b57cec5SDimitry Andric
13810b57cec5SDimitry Andric    friend bool operator==(const fisher_f_distribution& x,
13820b57cec5SDimitry Andric                           const fisher_f_distribution& y);
13830b57cec5SDimitry Andric    friend bool operator!=(const fisher_f_distribution& x,
13840b57cec5SDimitry Andric                           const fisher_f_distribution& y);
13850b57cec5SDimitry Andric
13860b57cec5SDimitry Andric    template <class charT, class traits>
13870b57cec5SDimitry Andric    friend
13880b57cec5SDimitry Andric    basic_ostream<charT, traits>&
13890b57cec5SDimitry Andric    operator<<(basic_ostream<charT, traits>& os,
13900b57cec5SDimitry Andric               const fisher_f_distribution& x);
13910b57cec5SDimitry Andric
13920b57cec5SDimitry Andric    template <class charT, class traits>
13930b57cec5SDimitry Andric    friend
13940b57cec5SDimitry Andric    basic_istream<charT, traits>&
13950b57cec5SDimitry Andric    operator>>(basic_istream<charT, traits>& is,
13960b57cec5SDimitry Andric               fisher_f_distribution& x);
13970b57cec5SDimitry Andric};
13980b57cec5SDimitry Andric
13990b57cec5SDimitry Andrictemplate<class RealType = double>
14000b57cec5SDimitry Andricclass student_t_distribution
14010b57cec5SDimitry Andric{
14020b57cec5SDimitry Andricpublic:
14030b57cec5SDimitry Andric    // types
14040b57cec5SDimitry Andric    typedef RealType result_type;
14050b57cec5SDimitry Andric
14060b57cec5SDimitry Andric    class param_type
14070b57cec5SDimitry Andric    {
14080b57cec5SDimitry Andric    public:
14090b57cec5SDimitry Andric        typedef student_t_distribution distribution_type;
14100b57cec5SDimitry Andric
14110b57cec5SDimitry Andric        explicit param_type(result_type n = 1);
14120b57cec5SDimitry Andric
14130b57cec5SDimitry Andric        result_type n() const;
14140b57cec5SDimitry Andric
14150b57cec5SDimitry Andric        friend bool operator==(const param_type& x, const param_type& y);
14160b57cec5SDimitry Andric        friend bool operator!=(const param_type& x, const param_type& y);
14170b57cec5SDimitry Andric    };
14180b57cec5SDimitry Andric
14190b57cec5SDimitry Andric    // constructor and reset functions
1420e8d8bef9SDimitry Andric    explicit student_t_distribution(RealType n = 1.0);        // before C++20
1421e8d8bef9SDimitry Andric    student_t_distribution() : student_t_distribution(1.0) {} // C++20
1422e8d8bef9SDimitry Andric    explicit student_t_distribution(RealType n);              // C++20
14230b57cec5SDimitry Andric    explicit student_t_distribution(const param_type& parm);
14240b57cec5SDimitry Andric    void reset();
14250b57cec5SDimitry Andric
14260b57cec5SDimitry Andric    // generating functions
14270b57cec5SDimitry Andric    template<class URNG> result_type operator()(URNG& g);
14280b57cec5SDimitry Andric    template<class URNG> result_type operator()(URNG& g, const param_type& parm);
14290b57cec5SDimitry Andric
14300b57cec5SDimitry Andric    // property functions
14310b57cec5SDimitry Andric    result_type n() const;
14320b57cec5SDimitry Andric
14330b57cec5SDimitry Andric    param_type param() const;
14340b57cec5SDimitry Andric    void param(const param_type& parm);
14350b57cec5SDimitry Andric
14360b57cec5SDimitry Andric    result_type min() const;
14370b57cec5SDimitry Andric    result_type max() const;
14380b57cec5SDimitry Andric
14390b57cec5SDimitry Andric    friend bool operator==(const student_t_distribution& x,
14400b57cec5SDimitry Andric                           const student_t_distribution& y);
14410b57cec5SDimitry Andric    friend bool operator!=(const student_t_distribution& x,
14420b57cec5SDimitry Andric                           const student_t_distribution& y);
14430b57cec5SDimitry Andric
14440b57cec5SDimitry Andric    template <class charT, class traits>
14450b57cec5SDimitry Andric    friend
14460b57cec5SDimitry Andric    basic_ostream<charT, traits>&
14470b57cec5SDimitry Andric    operator<<(basic_ostream<charT, traits>& os,
14480b57cec5SDimitry Andric               const student_t_distribution& x);
14490b57cec5SDimitry Andric
14500b57cec5SDimitry Andric    template <class charT, class traits>
14510b57cec5SDimitry Andric    friend
14520b57cec5SDimitry Andric    basic_istream<charT, traits>&
14530b57cec5SDimitry Andric    operator>>(basic_istream<charT, traits>& is,
14540b57cec5SDimitry Andric               student_t_distribution& x);
14550b57cec5SDimitry Andric};
14560b57cec5SDimitry Andric
14570b57cec5SDimitry Andrictemplate<class IntType = int>
14580b57cec5SDimitry Andricclass discrete_distribution
14590b57cec5SDimitry Andric{
14600b57cec5SDimitry Andricpublic:
14610b57cec5SDimitry Andric    // types
14620b57cec5SDimitry Andric    typedef IntType result_type;
14630b57cec5SDimitry Andric
14640b57cec5SDimitry Andric    class param_type
14650b57cec5SDimitry Andric    {
14660b57cec5SDimitry Andric    public:
14670b57cec5SDimitry Andric        typedef discrete_distribution distribution_type;
14680b57cec5SDimitry Andric
14690b57cec5SDimitry Andric        param_type();
14700b57cec5SDimitry Andric        template<class InputIterator>
14710b57cec5SDimitry Andric            param_type(InputIterator firstW, InputIterator lastW);
14720b57cec5SDimitry Andric        param_type(initializer_list<double> wl);
14730b57cec5SDimitry Andric        template<class UnaryOperation>
14740b57cec5SDimitry Andric            param_type(size_t nw, double xmin, double xmax, UnaryOperation fw);
14750b57cec5SDimitry Andric
14760b57cec5SDimitry Andric        vector<double> probabilities() const;
14770b57cec5SDimitry Andric
14780b57cec5SDimitry Andric        friend bool operator==(const param_type& x, const param_type& y);
14790b57cec5SDimitry Andric        friend bool operator!=(const param_type& x, const param_type& y);
14800b57cec5SDimitry Andric    };
14810b57cec5SDimitry Andric
14820b57cec5SDimitry Andric    // constructor and reset functions
14830b57cec5SDimitry Andric    discrete_distribution();
14840b57cec5SDimitry Andric    template<class InputIterator>
14850b57cec5SDimitry Andric        discrete_distribution(InputIterator firstW, InputIterator lastW);
14860b57cec5SDimitry Andric    discrete_distribution(initializer_list<double> wl);
14870b57cec5SDimitry Andric    template<class UnaryOperation>
14880b57cec5SDimitry Andric        discrete_distribution(size_t nw, double xmin, double xmax,
14890b57cec5SDimitry Andric                              UnaryOperation fw);
14900b57cec5SDimitry Andric    explicit discrete_distribution(const param_type& parm);
14910b57cec5SDimitry Andric    void reset();
14920b57cec5SDimitry Andric
14930b57cec5SDimitry Andric    // generating functions
14940b57cec5SDimitry Andric    template<class URNG> result_type operator()(URNG& g);
14950b57cec5SDimitry Andric    template<class URNG> result_type operator()(URNG& g, const param_type& parm);
14960b57cec5SDimitry Andric
14970b57cec5SDimitry Andric    // property functions
14980b57cec5SDimitry Andric    vector<double> probabilities() const;
14990b57cec5SDimitry Andric
15000b57cec5SDimitry Andric    param_type param() const;
15010b57cec5SDimitry Andric    void param(const param_type& parm);
15020b57cec5SDimitry Andric
15030b57cec5SDimitry Andric    result_type min() const;
15040b57cec5SDimitry Andric    result_type max() const;
15050b57cec5SDimitry Andric
15060b57cec5SDimitry Andric    friend bool operator==(const discrete_distribution& x,
15070b57cec5SDimitry Andric                           const discrete_distribution& y);
15080b57cec5SDimitry Andric    friend bool operator!=(const discrete_distribution& x,
15090b57cec5SDimitry Andric                           const discrete_distribution& y);
15100b57cec5SDimitry Andric
15110b57cec5SDimitry Andric    template <class charT, class traits>
15120b57cec5SDimitry Andric    friend
15130b57cec5SDimitry Andric    basic_ostream<charT, traits>&
15140b57cec5SDimitry Andric    operator<<(basic_ostream<charT, traits>& os,
15150b57cec5SDimitry Andric               const discrete_distribution& x);
15160b57cec5SDimitry Andric
15170b57cec5SDimitry Andric    template <class charT, class traits>
15180b57cec5SDimitry Andric    friend
15190b57cec5SDimitry Andric    basic_istream<charT, traits>&
15200b57cec5SDimitry Andric    operator>>(basic_istream<charT, traits>& is,
15210b57cec5SDimitry Andric               discrete_distribution& x);
15220b57cec5SDimitry Andric};
15230b57cec5SDimitry Andric
15240b57cec5SDimitry Andrictemplate<class RealType = double>
15250b57cec5SDimitry Andricclass piecewise_constant_distribution
15260b57cec5SDimitry Andric{
15270b57cec5SDimitry Andric    // types
15280b57cec5SDimitry Andric    typedef RealType result_type;
15290b57cec5SDimitry Andric
15300b57cec5SDimitry Andric    class param_type
15310b57cec5SDimitry Andric    {
15320b57cec5SDimitry Andric    public:
15330b57cec5SDimitry Andric        typedef piecewise_constant_distribution distribution_type;
15340b57cec5SDimitry Andric
15350b57cec5SDimitry Andric        param_type();
15360b57cec5SDimitry Andric        template<class InputIteratorB, class InputIteratorW>
15370b57cec5SDimitry Andric            param_type(InputIteratorB firstB, InputIteratorB lastB,
15380b57cec5SDimitry Andric                       InputIteratorW firstW);
15390b57cec5SDimitry Andric        template<class UnaryOperation>
15400b57cec5SDimitry Andric            param_type(initializer_list<result_type> bl, UnaryOperation fw);
15410b57cec5SDimitry Andric        template<class UnaryOperation>
15420b57cec5SDimitry Andric            param_type(size_t nw, result_type xmin, result_type xmax,
15430b57cec5SDimitry Andric                       UnaryOperation fw);
15440b57cec5SDimitry Andric
15450b57cec5SDimitry Andric        vector<result_type> intervals() const;
15460b57cec5SDimitry Andric        vector<result_type> densities() const;
15470b57cec5SDimitry Andric
15480b57cec5SDimitry Andric        friend bool operator==(const param_type& x, const param_type& y);
15490b57cec5SDimitry Andric        friend bool operator!=(const param_type& x, const param_type& y);
15500b57cec5SDimitry Andric    };
15510b57cec5SDimitry Andric
15520b57cec5SDimitry Andric    // constructor and reset functions
15530b57cec5SDimitry Andric    piecewise_constant_distribution();
15540b57cec5SDimitry Andric    template<class InputIteratorB, class InputIteratorW>
15550b57cec5SDimitry Andric        piecewise_constant_distribution(InputIteratorB firstB,
15560b57cec5SDimitry Andric                                        InputIteratorB lastB,
15570b57cec5SDimitry Andric                                        InputIteratorW firstW);
15580b57cec5SDimitry Andric    template<class UnaryOperation>
15590b57cec5SDimitry Andric        piecewise_constant_distribution(initializer_list<result_type> bl,
15600b57cec5SDimitry Andric                                        UnaryOperation fw);
15610b57cec5SDimitry Andric    template<class UnaryOperation>
15620b57cec5SDimitry Andric        piecewise_constant_distribution(size_t nw, result_type xmin,
15630b57cec5SDimitry Andric                                        result_type xmax, UnaryOperation fw);
15640b57cec5SDimitry Andric    explicit piecewise_constant_distribution(const param_type& parm);
15650b57cec5SDimitry Andric    void reset();
15660b57cec5SDimitry Andric
15670b57cec5SDimitry Andric    // generating functions
15680b57cec5SDimitry Andric    template<class URNG> result_type operator()(URNG& g);
15690b57cec5SDimitry Andric    template<class URNG> result_type operator()(URNG& g, const param_type& parm);
15700b57cec5SDimitry Andric
15710b57cec5SDimitry Andric    // property functions
15720b57cec5SDimitry Andric    vector<result_type> intervals() const;
15730b57cec5SDimitry Andric    vector<result_type> densities() const;
15740b57cec5SDimitry Andric
15750b57cec5SDimitry Andric    param_type param() const;
15760b57cec5SDimitry Andric    void param(const param_type& parm);
15770b57cec5SDimitry Andric
15780b57cec5SDimitry Andric    result_type min() const;
15790b57cec5SDimitry Andric    result_type max() const;
15800b57cec5SDimitry Andric
15810b57cec5SDimitry Andric    friend bool operator==(const piecewise_constant_distribution& x,
15820b57cec5SDimitry Andric                           const piecewise_constant_distribution& y);
15830b57cec5SDimitry Andric    friend bool operator!=(const piecewise_constant_distribution& x,
15840b57cec5SDimitry Andric                           const piecewise_constant_distribution& y);
15850b57cec5SDimitry Andric
15860b57cec5SDimitry Andric    template <class charT, class traits>
15870b57cec5SDimitry Andric    friend
15880b57cec5SDimitry Andric    basic_ostream<charT, traits>&
15890b57cec5SDimitry Andric    operator<<(basic_ostream<charT, traits>& os,
15900b57cec5SDimitry Andric               const piecewise_constant_distribution& x);
15910b57cec5SDimitry Andric
15920b57cec5SDimitry Andric    template <class charT, class traits>
15930b57cec5SDimitry Andric    friend
15940b57cec5SDimitry Andric    basic_istream<charT, traits>&
15950b57cec5SDimitry Andric    operator>>(basic_istream<charT, traits>& is,
15960b57cec5SDimitry Andric               piecewise_constant_distribution& x);
15970b57cec5SDimitry Andric};
15980b57cec5SDimitry Andric
15990b57cec5SDimitry Andrictemplate<class RealType = double>
16000b57cec5SDimitry Andricclass piecewise_linear_distribution
16010b57cec5SDimitry Andric{
16020b57cec5SDimitry Andric    // types
16030b57cec5SDimitry Andric    typedef RealType result_type;
16040b57cec5SDimitry Andric
16050b57cec5SDimitry Andric    class param_type
16060b57cec5SDimitry Andric    {
16070b57cec5SDimitry Andric    public:
16080b57cec5SDimitry Andric        typedef piecewise_linear_distribution distribution_type;
16090b57cec5SDimitry Andric
16100b57cec5SDimitry Andric        param_type();
16110b57cec5SDimitry Andric        template<class InputIteratorB, class InputIteratorW>
16120b57cec5SDimitry Andric            param_type(InputIteratorB firstB, InputIteratorB lastB,
16130b57cec5SDimitry Andric                       InputIteratorW firstW);
16140b57cec5SDimitry Andric        template<class UnaryOperation>
16150b57cec5SDimitry Andric            param_type(initializer_list<result_type> bl, UnaryOperation fw);
16160b57cec5SDimitry Andric        template<class UnaryOperation>
16170b57cec5SDimitry Andric            param_type(size_t nw, result_type xmin, result_type xmax,
16180b57cec5SDimitry Andric                       UnaryOperation fw);
16190b57cec5SDimitry Andric
16200b57cec5SDimitry Andric        vector<result_type> intervals() const;
16210b57cec5SDimitry Andric        vector<result_type> densities() const;
16220b57cec5SDimitry Andric
16230b57cec5SDimitry Andric        friend bool operator==(const param_type& x, const param_type& y);
16240b57cec5SDimitry Andric        friend bool operator!=(const param_type& x, const param_type& y);
16250b57cec5SDimitry Andric    };
16260b57cec5SDimitry Andric
16270b57cec5SDimitry Andric    // constructor and reset functions
16280b57cec5SDimitry Andric    piecewise_linear_distribution();
16290b57cec5SDimitry Andric    template<class InputIteratorB, class InputIteratorW>
16300b57cec5SDimitry Andric        piecewise_linear_distribution(InputIteratorB firstB,
16310b57cec5SDimitry Andric                                      InputIteratorB lastB,
16320b57cec5SDimitry Andric                                      InputIteratorW firstW);
16330b57cec5SDimitry Andric
16340b57cec5SDimitry Andric    template<class UnaryOperation>
16350b57cec5SDimitry Andric        piecewise_linear_distribution(initializer_list<result_type> bl,
16360b57cec5SDimitry Andric                                      UnaryOperation fw);
16370b57cec5SDimitry Andric
16380b57cec5SDimitry Andric    template<class UnaryOperation>
16390b57cec5SDimitry Andric        piecewise_linear_distribution(size_t nw, result_type xmin,
16400b57cec5SDimitry Andric                                      result_type xmax, UnaryOperation fw);
16410b57cec5SDimitry Andric
16420b57cec5SDimitry Andric    explicit piecewise_linear_distribution(const param_type& parm);
16430b57cec5SDimitry Andric    void reset();
16440b57cec5SDimitry Andric
16450b57cec5SDimitry Andric    // generating functions
16460b57cec5SDimitry Andric    template<class URNG> result_type operator()(URNG& g);
16470b57cec5SDimitry Andric    template<class URNG> result_type operator()(URNG& g, const param_type& parm);
16480b57cec5SDimitry Andric
16490b57cec5SDimitry Andric    // property functions
16500b57cec5SDimitry Andric    vector<result_type> intervals() const;
16510b57cec5SDimitry Andric    vector<result_type> densities() const;
16520b57cec5SDimitry Andric
16530b57cec5SDimitry Andric    param_type param() const;
16540b57cec5SDimitry Andric    void param(const param_type& parm);
16550b57cec5SDimitry Andric
16560b57cec5SDimitry Andric    result_type min() const;
16570b57cec5SDimitry Andric    result_type max() const;
16580b57cec5SDimitry Andric
16590b57cec5SDimitry Andric    friend bool operator==(const piecewise_linear_distribution& x,
16600b57cec5SDimitry Andric                           const piecewise_linear_distribution& y);
16610b57cec5SDimitry Andric    friend bool operator!=(const piecewise_linear_distribution& x,
16620b57cec5SDimitry Andric                           const piecewise_linear_distribution& y);
16630b57cec5SDimitry Andric
16640b57cec5SDimitry Andric    template <class charT, class traits>
16650b57cec5SDimitry Andric    friend
16660b57cec5SDimitry Andric    basic_ostream<charT, traits>&
16670b57cec5SDimitry Andric    operator<<(basic_ostream<charT, traits>& os,
16680b57cec5SDimitry Andric               const piecewise_linear_distribution& x);
16690b57cec5SDimitry Andric
16700b57cec5SDimitry Andric    template <class charT, class traits>
16710b57cec5SDimitry Andric    friend
16720b57cec5SDimitry Andric    basic_istream<charT, traits>&
16730b57cec5SDimitry Andric    operator>>(basic_istream<charT, traits>& is,
16740b57cec5SDimitry Andric               piecewise_linear_distribution& x);
16750b57cec5SDimitry Andric};
16760b57cec5SDimitry Andric
16770b57cec5SDimitry Andric} // std
16780b57cec5SDimitry Andric*/
16790b57cec5SDimitry Andric
16800b57cec5SDimitry Andric#include <__config>
16814824e7fdSDimitry Andric#include <__random/bernoulli_distribution.h>
16824824e7fdSDimitry Andric#include <__random/binomial_distribution.h>
16834824e7fdSDimitry Andric#include <__random/cauchy_distribution.h>
16844824e7fdSDimitry Andric#include <__random/chi_squared_distribution.h>
16854824e7fdSDimitry Andric#include <__random/default_random_engine.h>
16864824e7fdSDimitry Andric#include <__random/discard_block_engine.h>
16874824e7fdSDimitry Andric#include <__random/discrete_distribution.h>
16884824e7fdSDimitry Andric#include <__random/exponential_distribution.h>
16894824e7fdSDimitry Andric#include <__random/extreme_value_distribution.h>
16904824e7fdSDimitry Andric#include <__random/fisher_f_distribution.h>
16914824e7fdSDimitry Andric#include <__random/gamma_distribution.h>
16924824e7fdSDimitry Andric#include <__random/generate_canonical.h>
16934824e7fdSDimitry Andric#include <__random/geometric_distribution.h>
16944824e7fdSDimitry Andric#include <__random/independent_bits_engine.h>
16954824e7fdSDimitry Andric#include <__random/is_seed_sequence.h>
16964824e7fdSDimitry Andric#include <__random/knuth_b.h>
16974824e7fdSDimitry Andric#include <__random/linear_congruential_engine.h>
16984824e7fdSDimitry Andric#include <__random/lognormal_distribution.h>
16994824e7fdSDimitry Andric#include <__random/mersenne_twister_engine.h>
17004824e7fdSDimitry Andric#include <__random/negative_binomial_distribution.h>
17014824e7fdSDimitry Andric#include <__random/normal_distribution.h>
17024824e7fdSDimitry Andric#include <__random/piecewise_constant_distribution.h>
17034824e7fdSDimitry Andric#include <__random/piecewise_linear_distribution.h>
17044824e7fdSDimitry Andric#include <__random/poisson_distribution.h>
17054824e7fdSDimitry Andric#include <__random/random_device.h>
17064824e7fdSDimitry Andric#include <__random/ranlux.h>
17074824e7fdSDimitry Andric#include <__random/seed_seq.h>
17084824e7fdSDimitry Andric#include <__random/shuffle_order_engine.h>
17094824e7fdSDimitry Andric#include <__random/student_t_distribution.h>
17104824e7fdSDimitry Andric#include <__random/subtract_with_carry_engine.h>
1711fe6060f1SDimitry Andric#include <__random/uniform_int_distribution.h>
17124824e7fdSDimitry Andric#include <__random/uniform_random_bit_generator.h>
17134824e7fdSDimitry Andric#include <__random/uniform_real_distribution.h>
17144824e7fdSDimitry Andric#include <__random/weibull_distribution.h>
171504eeddc0SDimitry Andric#include <version>
17164824e7fdSDimitry Andric
171781ad6265SDimitry Andric// standard-mandated includes
171881ad6265SDimitry Andric
1719bdd1243dSDimitry Andric// [rand.synopsis]
1720bdd1243dSDimitry Andric#include <initializer_list>
17210b57cec5SDimitry Andric
17220b57cec5SDimitry Andric#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
17230b57cec5SDimitry Andric#  pragma GCC system_header
17240b57cec5SDimitry Andric#endif
17250b57cec5SDimitry Andric
1726bdd1243dSDimitry Andric#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
1727bdd1243dSDimitry Andric#  include <algorithm>
1728bdd1243dSDimitry Andric#  include <climits>
1729bdd1243dSDimitry Andric#  include <cmath>
1730bdd1243dSDimitry Andric#  include <concepts>
1731bdd1243dSDimitry Andric#  include <cstddef>
1732bdd1243dSDimitry Andric#  include <cstdint>
1733*06c3fb27SDimitry Andric#  include <cstdlib>
1734bdd1243dSDimitry Andric#  include <iosfwd>
1735bdd1243dSDimitry Andric#  include <limits>
1736bdd1243dSDimitry Andric#  include <numeric>
1737bdd1243dSDimitry Andric#  include <string>
1738bdd1243dSDimitry Andric#  include <type_traits>
1739bdd1243dSDimitry Andric#  include <vector>
1740bdd1243dSDimitry Andric#endif
1741bdd1243dSDimitry Andric
17420b57cec5SDimitry Andric#endif // _LIBCPP_RANDOM
1743