1 #ifndef STAN_MATH_PRIM_SCAL_PROB_UNIFORM_RNG_HPP 2 #define STAN_MATH_PRIM_SCAL_PROB_UNIFORM_RNG_HPP 5 #include <boost/random/uniform_real_distribution.hpp> 6 #include <boost/random/variate_generator.hpp> 35 template <
typename T_alpha,
typename T_beta,
class RNG>
37 const T_alpha& alpha,
const T_beta&
beta, RNG& rng) {
38 using boost::random::uniform_real_distribution;
39 using boost::variate_generator;
41 static const char*
function =
"uniform_rng";
46 "Upper bound parameter", beta);
47 check_greater(
function,
"Upper bound parameter", beta, alpha);
54 variate_generator<RNG&, uniform_real_distribution<> >
uniform_rng(
55 rng, uniform_real_distribution<>(0.0, 1.0));
56 for (
size_t n = 0; n < N; ++n) {
57 output[n] = (beta_vec[n] - alpha_vec[n]) *
uniform_rng() + alpha_vec[n];
void check_finite(const char *function, const char *name, const T_y &y)
Check if y is finite.
scalar_seq_view provides a uniform sequence-like wrapper around either a scalar or a sequence of scal...
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...
fvar< T > beta(const fvar< T > &x1, const fvar< T > &x2)
Return fvar with the beta function applied to the specified arguments and its gradient.
size_t max_size(const T1 &x1, const T2 &x2)
VectorBuilder allocates type T1 values to be used as intermediate values.
void check_greater(const char *function, const char *name, const T_y &y, const T_low &low)
Check if y is strictly greater than low.
void check_consistent_sizes(const char *function, const char *name1, const T1 &x1, const char *name2, const T2 &x2)
Check if the dimension of x1 is consistent with x2.