1 #ifndef STAN_MATH_PRIM_SCAL_PROB_BERNOULLI_RNG_HPP 2 #define STAN_MATH_PRIM_SCAL_PROB_BERNOULLI_RNG_HPP 9 #include <boost/random/bernoulli_distribution.hpp> 10 #include <boost/random/variate_generator.hpp> 29 template <
typename T_theta,
class RNG>
31 const T_theta&
theta, RNG& rng) {
32 using boost::bernoulli_distribution;
33 using boost::variate_generator;
35 static const char*
function =
"bernoulli_rng";
38 check_bounded(
function,
"Probability parameter", theta, 0.0, 1.0);
44 for (
size_t n = 0;
n < N; ++
n) {
45 variate_generator<RNG&, bernoulli_distribution<> >
bernoulli_rng(
46 rng, bernoulli_distribution<>(theta_vec[
n]));
void check_finite(const char *function, const char *name, const T_y &y)
void check_bounded(const char *function, const char *name, const T_y &y, const T_low &low, const T_high &high)
VectorBuilder< true, int, T_theta >::type bernoulli_rng(const T_theta &theta, RNG &rng)
size_t length(const std::vector< T > &x)