32 #ifndef SHARK_RNG_BERNOULLI_H 33 #define SHARK_RNG_BERNOULLI_H 37 #include <boost/random.hpp> 64 template<
typename RngType = shark::DefaultRngType>
65 class Bernoulli :
public boost::variate_generator< RngType*,boost::bernoulli_distribution<> >
68 typedef boost::variate_generator<RngType*,boost::bernoulli_distribution<> > Base;
83 :Base(&rng,
boost::bernoulli_distribution<>(
prob))
92 using Base::operator();
103 boost::bernoulli_distribution<> dist(p);
104 return dist(Base::engine());
113 return Base::distribution().p();
123 Base::distribution()=boost::bernoulli_distribution<>(newP);
129 double p(
bool x)
const 137 template<
class RngType>