48 #ifndef _MIRA_RANDOMGENERATOR_H_ 49 #define _MIRA_RANDOMGENERATOR_H_ 54 #include <boost/random/mersenne_twister.hpp> 55 #include <boost/random/variate_generator.hpp> 56 #include <boost/random/uniform_real.hpp> 57 #include <boost/random/uniform_int.hpp> 95 template <
typename Distribution,
typename Engine=boost::mt19937>
111 mGenerator(mEngine, Distribution()) {
122 mGenerator(mEngine, dist) {
144 mGenerator.distribution() = dist;
197 return &mGenerator.distribution();
204 return &mGenerator.distribution();
211 return mGenerator.distribution();
218 return mGenerator.distribution();
241 boost::variate_generator<Engine&, Distribution> mGenerator;
249 #define MIRA_RANDOM_GENERATOR_COMMON(Derived, TDistribution) \ 250 typedef RandomGenerator<TDistribution> Base; \ 251 typedef TDistribution Distribution; \ 252 Derived(const Distribution& dist) : Base(dist) {} \ 253 Derived(const Derived& other) : Base(other) {} \ 254 Derived& operator=(const Distribution& dist) { \ 255 Base::operator=(dist); \ 258 Derived& operator=(const Derived& other) { \ 259 Base::operator=(other); \ RandomGenerator & operator=(const Distribution &dist)
Assigns the given distribution (respectively its parameters) to this random generator.
Definition: RandomGenerator.h:143
Typedefs for OS independent basic data types.
RandomGenerator & operator=(const RandomGenerator &other)
Assignment operator that copies the distribution but not the random generator engine, since engines cannot be copied.
Definition: RandomGenerator.h:156
void seed()
Seeds the random generator using the current system time.
Definition: RandomGenerator.h:178
Engine & engine()
Provides direct access to the underlying random generator engine.
Definition: RandomGenerator.h:226
const Engine & engine() const
Provides direct access to the underlying random generator engine.
Definition: RandomGenerator.h:233
specialize cv::DataType for our ImgPixel and inherit from cv::DataType<Vec>
Definition: IOService.h:67
Distribution & distribution()
Provides direct access to the underlying random distribution.
Definition: RandomGenerator.h:210
Time and Duration wrapper class.
Template class to easily generate random generators using the boost::random distributions and generat...
Definition: RandomGenerator.h:96
static Time unixEpoch()
Returns the unix epoch 1.1.1970 0:0:0.000.
Definition: Time.h:509
RandomGenerator()
Generates the random generator with default parameters for the random distribution.
Definition: RandomGenerator.h:110
const Distribution & distribution() const
Provides direct access to the underlying random distribution.
Definition: RandomGenerator.h:217
Distribution * operator->()
Provides direct access to the underlying random distribution.
Definition: RandomGenerator.h:196
const Distribution * operator->() const
Provides direct access to the underlying random distribution.
Definition: RandomGenerator.h:203
RandomGenerator(const RandomGenerator &other)
Copy constructor that copies the distribution but initializes the random generator engine from the sc...
Definition: RandomGenerator.h:133
Distribution::result_type result_type
Definition: RandomGenerator.h:99
RandomGenerator(const Distribution &dist)
Generates the random generator with the parameters provided by the given distribution.
Definition: RandomGenerator.h:121
result_type operator()()
Draws a sample from the random distribution.
Definition: RandomGenerator.h:167
static Time now() static Time eternity()
Returns the current utc based time.
Definition: Time.h:479
void seed(uint32 value)
Seeds the random generator with the given seed.
Definition: RandomGenerator.h:187