Skip to content

Commit bff6794

Browse files
authored
Missed ref usage in RNG
1 parent ad50aee commit bff6794

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

stan/math/prim/prob/poisson_binomial_rng.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ namespace math {
2424
template <typename T_theta, typename RNG>
2525
inline int poisson_binomial_rng(const T_theta& theta, RNG& rng) {
2626
static constexpr const char* function = "poisson_binomial_rng";
27-
check_finite(function, "Probability parameters", theta);
28-
check_bounded(function, "Probability parameters", value_of(theta), 0.0, 1.0);
2927
ref_type_t<T_theta> theta_ref = theta;
28+
check_finite(function, "Probability parameters", theta_ref);
29+
check_bounded(function, "Probability parameters", theta_ref, 0.0, 1.0);
3030

3131
int y = 0;
3232
for (size_t i = 0; i < theta.size(); ++i) {
3333
boost::variate_generator<RNG&, boost::bernoulli_distribution<> >
34-
bernoulli_rng(rng, boost::bernoulli_distribution<>(theta[i]));
34+
bernoulli_rng(rng, boost::bernoulli_distribution<>(theta_ref[i]));
3535
y += bernoulli_rng();
3636
}
3737

0 commit comments

Comments
 (0)