Stan Math Library  2.9.0
reverse mode automatic differentiation
cauchy_rng.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_SCAL_PROB_CAUCHY_RNG_HPP
2 #define STAN_MATH_PRIM_SCAL_PROB_CAUCHY_RNG_HPP
3 
4 #include <boost/random/cauchy_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  cauchy_rng(const double mu,
24  const double sigma,
25  RNG& rng) {
26  using boost::variate_generator;
27  using boost::random::cauchy_distribution;
28 
29  static const char* function("stan::math::cauchy_rng");
30 
33 
34  check_finite(function, "Location parameter", mu);
35  check_positive_finite(function, "Scale parameter", sigma);
36 
37  variate_generator<RNG&, cauchy_distribution<> >
38  cauchy_rng(rng, cauchy_distribution<>(mu, sigma));
39  return cauchy_rng();
40  }
41  }
42 }
43 #endif
double cauchy_rng(const double mu, const double sigma, RNG &rng)
Definition: cauchy_rng.hpp:23
bool check_finite(const char *function, const char *name, const T_y &y)
Return true if y is finite.
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.