Stan Math Library  2.8.0
reverse mode automatic differentiation
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros Groups
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>
17 
18 namespace stan {
19 
20  namespace math {
21 
22  template <class RNG>
23  inline double
24  weibull_rng(const double alpha,
25  const double sigma,
26  RNG& rng) {
27  using boost::variate_generator;
28  using boost::random::weibull_distribution;
29 
30  static const char* function("stan::math::weibull_rng");
31 
33 
34  check_positive_finite(function, "Shape parameter", alpha);
35  check_positive_finite(function, "Scale parameter", sigma);
36 
37  variate_generator<RNG&, weibull_distribution<> >
38  weibull_rng(rng, weibull_distribution<>(alpha, sigma));
39  return weibull_rng();
40  }
41  }
42 }
43 #endif
double weibull_rng(const double alpha, const double sigma, RNG &rng)
Definition: weibull_rng.hpp:24
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–2015, Stan Development Team.