Stan Math Library  2.12.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 
20  template <class RNG>
21  inline double
22  weibull_rng(const double alpha,
23  const double sigma,
24  RNG& rng) {
25  using boost::variate_generator;
26  using boost::random::weibull_distribution;
27 
28  static const char* function("weibull_rng");
29 
30  check_positive_finite(function, "Shape parameter", alpha);
31  check_positive_finite(function, "Scale parameter", sigma);
32 
33  variate_generator<RNG&, weibull_distribution<> >
34  weibull_rng(rng, weibull_distribution<>(alpha, sigma));
35  return weibull_rng();
36  }
37 
38  }
39 }
40 #endif
double weibull_rng(const double alpha, const double sigma, RNG &rng)
Definition: weibull_rng.hpp:22
bool check_positive_finite(const char *function, const char *name, const T_y &y)
Return true if y is positive and finite.

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