1#ifndef STAN_MATH_PRIM_PROB_BINOMIAL_RNG_HPP
2#define STAN_MATH_PRIM_PROB_BINOMIAL_RNG_HPP
8#include <boost/random/binomial_distribution.hpp>
9#include <boost/random/variate_generator.hpp>
31template <
typename T_N,
typename T_theta,
class RNG>
33 const T_N& N,
const T_theta& theta, RNG& rng) {
34 using boost::binomial_distribution;
35 using boost::variate_generator;
38 static constexpr const char* function =
"binomial_rng";
40 "Probability Parameter", theta);
42 T_theta_ref theta_ref = theta;
52 for (
size_t m = 0; m < M; ++m) {
53 variate_generator<RNG&, binomial_distribution<> >
binomial_rng(
54 rng, binomial_distribution<>(N_vec[m], theta_vec[m]));
typename helper::type type
VectorBuilder allocates type T1 values to be used as intermediate values.
scalar_seq_view provides a uniform sequence-like wrapper around either a scalar or a sequence of scal...
VectorBuilder< true, int, T_N, T_theta >::type binomial_rng(const T_N &N, const T_theta &theta, RNG &rng)
Return a pseudorandom binomial random variable for the given population size and chance of success pa...
void check_nonnegative(const char *function, const char *name, const T_y &y)
Check if y is non-negative.
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.
T value_of(const fvar< T > &v)
Return the value of the specified variable.
void check_consistent_sizes(const char *)
Trivial no input case, this function is a no-op.
int64_t max_size(const T1 &x1, const Ts &... xs)
Calculate the size of the largest input.
typename ref_type_if< true, T >::type ref_type_t
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...