32 #ifndef SHARK_RNG_NEGEXPONENTIAL_H 33 #define SHARK_RNG_NEGEXPONENTIAL_H 38 #include <boost/random/exponential_distribution.hpp> 50 template<
typename RngType = shark::DefaultRngType>
51 class NegExponential:
public boost::variate_generator<RngType*,boost::exponential_distribution<> >
54 typedef boost::variate_generator<RngType*,boost::exponential_distribution<> > Base;
58 :Base(&rng,
boost::exponential_distribution<>(1.0/
mean))
61 using Base::operator();
68 boost::exponential_distribution<> dist(1.0/mean);
69 return dist(Base::engine());
75 return 1.0/Base::distribution().lambda();
82 Base::distribution()=boost::exponential_distribution<>(1.0/newMean);
87 return x >= 0 ? Base::distribution().lambda() * exp(- Base::distribution().
lambda() * x) : 0.;