GPLIB++
UniformRNG.h
Go to the documentation of this file.
1 #ifndef CUNIFORMRNG_H
2 #define CUNIFORMRNG_H
3 
4 #include "GeneralRNG.h"
5 #include <boost/random/lagged_fibonacci.hpp>
6 #include <boost/random/uniform_01.hpp>
7 
8 namespace gplib
9  {
10  /** \addtogroup gainv Genetic algorithm optimization */
11  /* @{ */
12  //! Generate uniformly distributed random numbers, this is basically a wrapper for the boost random number generators, that is a little easier to use
13  /*! During the GA inversion we need a lot of uniformly distributed random numbers,
14  * some between 0 and 1, some between a specified minimum and maximum.
15  * This class provides a simple and consistent interface to the high quality
16  * boost random number generator.
17  *
18  */
19  class UniformRNG: public GeneralRNG
20  {
21  private:
22  boost::lagged_fibonacci607 generator;
23  boost::uniform_01<boost::lagged_fibonacci607> real_dist;
24  public:
25  //! Return a random float between low and high
26  float GetNumber(const float low, const float high);
27  //! Returns a random float between 0 and 1
28  virtual float GetNumber();
29  //! Return a random integer between 0 and max-1
30  virtual unsigned int GetNumber(const unsigned int max);
31  UniformRNG();
32  virtual ~UniformRNG();
33  };
34  /* @} */
35  }
36 #endif // CUNIFORMRNG_H
Generate uniformly distributed random numbers, this is basically a wrapper for the boost random numbe...
Definition: UniformRNG.h:19
virtual ~UniformRNG()
Definition: UniformRNG.cpp:17
virtual float GetNumber()
Returns a random float between 0 and 1.
Definition: UniformRNG.cpp:27
The base class for all random number generators, defines the basic interface.
Definition: GeneralRNG.h:9