1 #ifndef STAN_MATH_PRIM_SCAL_PROB_HYPERGEOMETRIC_RNG_HPP
2 #define STAN_MATH_PRIM_SCAL_PROB_HYPERGEOMETRIC_RNG_HPP
4 #include <boost/math/distributions/hypergeometric.hpp>
17 using boost::variate_generator;
18 using boost::math::hypergeometric_distribution;
22 static const char*
function(
"stan::math::hypergeometric_rng");
29 hypergeometric_distribution<>
dist(b, N, a + b);
35 int mid = (min +
max) / 2;
36 if (cdf(dist, mid + 1) > u)
int min(const std::vector< int > &x)
Returns the minimum coefficient in the specified column vector.
bool check_bounded(const char *function, const char *name, const T_y &y, const T_low &low, const T_high &high)
Return true if the value is between the low and high values, inclusively.
bool check_positive(const char *function, const char *name, const T_y &y)
Return true if y is positive.
double uniform_rng(const double alpha, const double beta, RNG &rng)
int max(const std::vector< int > &x)
Returns the maximum coefficient in the specified column vector.
double dist(const std::vector< double > &x, const std::vector< double > &y)
int hypergeometric_rng(int N, int a, int b, RNG &rng)