Stan Math Library  2.10.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 
19  namespace math {
20 
21  template <class RNG>
22  inline double
23  weibull_rng(const double alpha,
24  const double sigma,
25  RNG& rng) {
26  using boost::variate_generator;
27  using boost::random::weibull_distribution;
28 
29  static const char* function("stan::math::weibull_rng");
30 
32 
33  check_positive_finite(function, "Shape parameter", alpha);
34  check_positive_finite(function, "Scale parameter", sigma);
35 
36  variate_generator<RNG&, weibull_distribution<> >
37  weibull_rng(rng, weibull_distribution<>(alpha, sigma));
38  return weibull_rng();
39  }
40  }
41 }
42 #endif
double weibull_rng(const double alpha, const double sigma, RNG &rng)
Definition: weibull_rng.hpp:23
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.