Stan Math Library  2.15.0
reverse mode automatic differentiation
weibull_rng.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_SCAL_PROB_WEIBULL_RNG_HPP
2 #define STAN_MATH_PRIM_SCAL_PROB_WEIBULL_RNG_HPP
3 
4 #include <boost/random/weibull_distribution.hpp>
5 #include <boost/random/variate_generator.hpp>
16 
17 namespace stan {
18  namespace math {
19 
31  template <class RNG>
32  inline double
33  weibull_rng(double alpha,
34  double sigma,
35  RNG& rng) {
36  using boost::variate_generator;
37  using boost::random::weibull_distribution;
38 
39  static const char* function("weibull_rng");
40 
41  check_positive_finite(function, "Shape parameter", alpha);
42  check_positive_finite(function, "Scale parameter", sigma);
43 
44  variate_generator<RNG&, weibull_distribution<> >
45  weibull_rng(rng, weibull_distribution<>(alpha, sigma));
46  return weibull_rng();
47  }
48 
49  }
50 }
51 #endif
void check_positive_finite(const char *function, const char *name, const T_y &y)
Check if y is positive and finite.
double weibull_rng(double alpha, double sigma, RNG &rng)
Return a pseudorandom Weibull variate with given shape and scale using the specified random number ge...
Definition: weibull_rng.hpp:33

     [ Stan Home Page ] © 2011–2016, Stan Development Team.