summaryrefslogtreecommitdiff
path: root/decoder
diff options
context:
space:
mode:
Diffstat (limited to 'decoder')
-rw-r--r--decoder/sampler.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/decoder/sampler.h b/decoder/sampler.h
index cc13229b..5fef45d0 100644
--- a/decoder/sampler.h
+++ b/decoder/sampler.h
@@ -14,6 +14,7 @@
#include <boost/random/variate_generator.hpp>
#include <boost/random/normal_distribution.hpp>
#include <boost/random/poisson_distribution.hpp>
+#include <boost/random/uniform_int.hpp>
#include "prob.h"
@@ -78,6 +79,13 @@ struct RandomNumberGenerator {
return (prob_t(this->next()) < a);
}
+ RNG &gen() { return m_generator; }
+ typedef boost::variate_generator<RNG&, boost::uniform_int<> > IntRNG;
+ IntRNG inclusive(int low,int high_incl) {
+ assert(high_incl>=low);
+ return IntRNG(m_generator,boost::uniform_int<>(low,high_incl));
+ }
+
private:
boost::uniform_real<> m_dist;
RNG m_generator;