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/iterator/iterator_concepts.hpp>
34 #include <boost/thread.hpp>
35 #include <boost/thread/tss.hpp>
37 #include <gsl/gsl_rng.h>
38 #include <gsl/gsl_randist.h>
113 unsigned long max(
void)
const;
119 unsigned long min(
void)
const;
124 std::string
name(
void)
const;
133 const gsl_rng*
rng(
void)
const;
148 void seed(
unsigned long s)
const;
190 RNG& operator=(
const RNG&);
193 void rng_alloc(
void)
const;
195 static RNG* instance_;
198 mutable boost::thread_specific_ptr<gsl_rng> rng_;
199 mutable unsigned long seed_;
201 mutable boost::mutex mutex_;
202 static boost::mutex init_mutex_;
232 const gsl_rng*
rng(
void)
const;
244 void clone(
const gsl_rng&);
288 void seed(
unsigned long s)
const YAT_DEPRECATE;
384 gsl_ran_discrete_t* gen_;
385 std::vector<double> p_;
402 public std::unary_function<unsigned long, unsigned long>
441 unsigned long operator()(
unsigned long n)
const;
444 unsigned long range_;
518 unsigned long int operator()(
unsigned int n1,
unsigned int n2,
519 unsigned int t)
const;
562 unsigned long int operator()(
unsigned int n1,
unsigned int n2,
563 unsigned int t)
const;
594 explicit Poisson(
const double m=1);
607 unsigned long operator()(
const double m)
const;
650 void seed(
unsigned long s)
const YAT_DEPRECATE;
776 explicit Gaussian(
const double s=1,
const double m=0);
797 double operator()(
const double s,
const double m)
const;
814 template<
typename RandomAccessIterator>
818 std::random_shuffle(first, last, rnd);
General.
Definition: random.h:341
const gsl_rng * rng(void) const
virtual ~Discrete(void)
The destructor.
Discrete(void)
Constructor.
Discrete random number distributions.
Definition: random.h:258
Generates numbers from a histogram in a continuous manner.
Definition: random.h:693
Random Number Generator.
Definition: random.h:86
void seed(unsigned long s) const
Set the seed s for the rng.
unsigned long int result_type
Definition: random.h:266
~RNG_state(void)
Destructor.
Class holding state of a random generator.
Definition: random.h:209
Generator of random numbers from an exponential distribution.
Definition: random.h:727
unsigned long seed_from_devurandom(void)
Seed the rng using the /dev/urandom device.
Poisson Distribution.
Definition: random.h:586
Geomtric Distribution.
Definition: random.h:458
void random_shuffle(RandomAccessIterator first, RandomAccessIterator last)
Convenience function to shuffle a range with singleton RNG.
Definition: random.h:815
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:53
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:620
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:317
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:307
double result_type
Definition: random.h:628
Gaussian distribution.
Definition: random.h:767
unsigned long seed_from_devurandom(void)
Set the seed using the /dev/urandom device.