libstdc++-v3/testsuite/ext/random/hypergeometric_distribution/pr60037.cc
raw| 1 | // { dg-options "-O0" } |
| 2 | // { dg-do run { target c++11 } } |
| 3 | // { dg-require-cstdint "" } |
| 4 | // { dg-require-cmath "" } |
| 5 | |
| 6 | #include <ext/random> |
| 7 | #include <functional> |
| 8 | |
| 9 | void |
| 10 | hyperplot(unsigned int N, unsigned int K, unsigned int n) |
| 11 | { |
| 12 | std::mt19937 re; // the default engine |
| 13 | __gnu_cxx::hypergeometric_distribution<> hd(N, K, n); |
| 14 | auto gen = std::bind(hd, re); |
| 15 | gen(); |
| 16 | } |
| 17 | |
| 18 | int |
| 19 | main() |
| 20 | { |
| 21 | hyperplot(15, 3, 2); |
| 22 | hyperplot(500, 50, 30); |
| 23 | hyperplot(100, 20, 5); |
| 24 | } |