1 #ifndef _theplu_yat_random_
2 #define _theplu_yat_random_
26 #include "yat/statistics/Histogram.h"
30 #include "yat/utility/boost_exception_ptr.h"
32 #include <boost/concept_check.hpp>
33 #include <boost/thread.hpp>
34 #include <boost/thread/tss.hpp>
36 #include <gsl/gsl_rng.h>
37 #include <gsl/gsl_randist.h>
112 unsigned long max(
void)
const;
118 unsigned long min(
void)
const;
123 std::string
name(
void)
const;
132 const gsl_rng*
rng(
void)
const;
147 void seed(
unsigned long s)
const;
189 RNG& operator=(
const RNG&);
192 void rng_alloc(
void)
const;
194 static RNG* instance_;
197 mutable boost::thread_specific_ptr<gsl_rng> rng_;
198 mutable unsigned long seed_;
200 mutable boost::mutex mutex_;
230 const gsl_rng*
rng(
void)
const;
242 void clone(
const gsl_rng&);
286 void seed(
unsigned long s)
const YAT_DEPRECATE;
382 gsl_ran_discrete_t* gen_;
383 std::vector<double> p_;
400 public std::unary_function<unsigned long, unsigned long>
439 unsigned long operator()(
unsigned long n)
const;
442 unsigned long range_;
468 explicit Poisson(
const double m=1);
481 unsigned long operator()(
const double m)
const;
524 void seed(
unsigned long s)
const YAT_DEPRECATE;
650 explicit Gaussian(
const double s=1,
const double m=0);
671 double operator()(
const double s,
const double m)
const;
687 template<
typename RandomAccessIterator>
690 typedef RandomAccessIterator rai;
691 BOOST_CONCEPT_ASSERT((boost::Mutable_RandomAccessIterator<rai>));
693 std::random_shuffle(first, last, rnd);
General.
Definition: random.h:339
const gsl_rng * rng(void) const
virtual ~Discrete(void)
The destructor.
Discrete(void)
Constructor.
Discrete random number distributions.
Definition: random.h:256
Generates numbers from a histogram in a continuous manner.
Definition: random.h:567
Random Number Generator.
Definition: random.h:85
void seed(unsigned long s) const
Set the seed s for the rng.
unsigned long int result_type
Definition: random.h:264
~RNG_state(void)
Destructor.
Class holding state of a random generator.
Definition: random.h:207
Generator of random numbers from an exponential distribution.
Definition: random.h:601
unsigned long seed_from_devurandom(void)
Seed the rng using the /dev/urandom device.
Poisson Distribution.
Definition: random.h:460
void random_shuffle(RandomAccessIterator first, RandomAccessIterator last)
Convenience function to shuffle a range with singleton RNG.
Definition: random.h:688
RNG_state & operator=(const RNG_state &)
std::string name(void) const
Returns the name of the random number generator.
RNG_state(const RNG *)
Constructor.
Histograms provide a convenient way of presenting the distribution of a set of data.
Definition: Histogram.h:52
virtual result_type operator()(void) const =0
unsigned long max(void) const
Returns the largest number that the random number generator can return.
int set_state(const RNG_state &)
Set the state to state.
Continuous random number distributions.
Definition: random.h:494
void seed(unsigned long s) const
Set the seed to s.
unsigned long min(void) const
Returns the smallest number that the random number generator can return.
Binomial distribution.
Definition: random.h:315
const gsl_rng * rng(void) const
static RNG * instance(void)
Get an instance of the Random Number Generator.
RNG * rng_
GSL random gererator.
Definition: random.h:305
double result_type
Definition: random.h:502
Gaussian distribution.
Definition: random.h:641
unsigned long seed_from_devurandom(void)
Set the seed using the /dev/urandom device.