1 // { dg-do run { target c++11 } }
2 // { dg-require-cstdint "" }
3 // { dg-require-cmath "" }
5 // Copyright (C) 2011-2021 Free Software Foundation, Inc.
7 // This file is part of the GNU ISO C++ Library. This library is free
8 // software; you can redistribute it and/or modify it under the
9 // terms of the GNU General Public License as published by the
10 // Free Software Foundation; either version 3, or (at your option)
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License along
19 // with this library; see the file COPYING3. If not see
20 // <http://www.gnu.org/licenses/>.
22 // 26.5.8.3.4 Class template negative_binomial_distribution
23 // [rand.dist.bern.negbin]
27 #include <testsuite_random.h>
31 using namespace __gnu_test
;
35 std::negative_binomial_distribution
<> nbd1(5, 0.3);
36 auto bnbd1
= std::bind(nbd1
, eng
);
37 testDiscreteDist(bnbd1
, [](int n
)
38 { return negative_binomial_pdf(n
, 5, 0.3); } );
40 std::negative_binomial_distribution
<> nbd2(55, 0.3);
41 auto bnbd2
= std::bind(nbd2
, eng
);
42 testDiscreteDist(bnbd2
, [](int n
)
43 { return negative_binomial_pdf(n
, 55, 0.3); } );
45 std::negative_binomial_distribution
<> nbd3(10, 0.75);
46 auto bnbd3
= std::bind(nbd3
, eng
);
47 testDiscreteDist(bnbd3
, [](int n
)
48 { return negative_binomial_pdf(n
, 10, 0.75); } );