1 #ifndef STAN_MATH_PRIM_SCAL_PROB_HYPERGEOMETRIC_RNG_HPP 2 #define STAN_MATH_PRIM_SCAL_PROB_HYPERGEOMETRIC_RNG_HPP 5 #include <boost/math/distributions/hypergeometric.hpp> 16 using boost::math::hypergeometric_distribution;
17 using boost::variate_generator;
19 static const char*
function =
"hypergeometric_rng";
26 hypergeometric_distribution<> dist(b, N, a + b);
32 int mid = (min +
max) / 2;
33 if (cdf(dist, mid + 1) > u)
void check_bounded(const char *function, const char *name, const T_y &y, const T_low &low, const T_high &high)
Check if the value is between the low and high values, inclusively.
int min(const std::vector< int > &x)
Returns the minimum coefficient in the specified column vector.
VectorBuilder< true, double, T_alpha, T_beta >::type uniform_rng(const T_alpha &alpha, const T_beta &beta, RNG &rng)
Return a uniform random variate for the given upper and lower bounds using the specified random numbe...
int max(const std::vector< int > &x)
Returns the maximum coefficient in the specified column vector.
void check_positive(const char *function, const char *name, const T_y &y)
Check if y is positive.
int hypergeometric_rng(int N, int a, int b, RNG &rng)