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_;
231 const gsl_rng*
rng(
void)
const;
243 void clone(
const gsl_rng&);
287 void seed(
unsigned long s)
const YAT_DEPRECATE;
383 gsl_ran_discrete_t* gen_;
384 std::vector<double> p_;
401 public std::unary_function<unsigned long, unsigned long>
440 unsigned long operator()(
unsigned long n)
const;
443 unsigned long range_;
469 explicit Poisson(
const double m=1);
482 unsigned long operator()(
const double m)
const;
525 void seed(
unsigned long s)
const YAT_DEPRECATE;
651 explicit Gaussian(
const double s=1,
const double m=0);
672 double operator()(
const double s,
const double m)
const;
690 template<
typename RandomAccessIterator>
693 typedef RandomAccessIterator rai;
694 BOOST_CONCEPT_ASSERT((boost_concepts::SwappableIterator<rai>));
695 BOOST_CONCEPT_ASSERT((boost_concepts::RandomAccessTraversal<rai>));
697 std::random_shuffle(first, last, rnd);
General.
Definition: random.h:340
const gsl_rng * rng(void) const
virtual ~Discrete(void)
The destructor.
Discrete(void)
Constructor.
Discrete random number distributions.
Definition: random.h:257
Generates numbers from a histogram in a continuous manner.
Definition: random.h:568
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:265
~RNG_state(void)
Destructor.
Class holding state of a random generator.
Definition: random.h:208
Generator of random numbers from an exponential distribution.
Definition: random.h:602
unsigned long seed_from_devurandom(void)
Seed the rng using the /dev/urandom device.
Poisson Distribution.
Definition: random.h:461
void random_shuffle(RandomAccessIterator first, RandomAccessIterator last)
Convenience function to shuffle a range with singleton RNG.
Definition: random.h:691
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:495
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:316
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:306
double result_type
Definition: random.h:503
Gaussian distribution.
Definition: random.h:642
unsigned long seed_from_devurandom(void)
Set the seed using the /dev/urandom device.