UniformRNG.h

Go to the documentation of this file.
00001 #ifndef CUNIFORMRNG_H
00002 #define CUNIFORMRNG_H
00003 
00004 #include "GeneralRNG.h"
00005 #include <boost/random/lagged_fibonacci.hpp>
00006 #include <boost/random/uniform_01.hpp>
00007 
00008 namespace gplib
00009   {
00010     /** \addtogroup gainv Genetic algorithm optimization */
00011     /* @{ */
00012     //! Generate uniformly distributed random numbers, this is basically a wrapper for the boost random number generators, that is a little easier to use
00013     /*! During the GA inversion we need a lot of uniformly distributed random numbers,
00014      * some between 0 and 1, some between a specified minimum and maximum.
00015      * This class provides a simple and consistent interface to the high quality
00016      * boost random number generator.
00017      *
00018      */
00019     class UniformRNG: public GeneralRNG
00020       {
00021     private:
00022       boost::lagged_fibonacci607 generator;
00023       boost::uniform_01<boost::lagged_fibonacci607> real_dist;
00024     public:
00025       //! Return a random float between low and high
00026       float GetNumber(const float low, const float high);
00027       //! Returns a random float between 0 and 1
00028       virtual float GetNumber();
00029       //! Return a random integer between 0 and max-1
00030       virtual unsigned int GetNumber(const unsigned int max);
00031       UniformRNG();
00032       virtual ~UniformRNG();
00033       };
00034   /* @} */
00035   }
00036 #endif // CUNIFORMRNG_H

Generated on Tue May 4 16:52:15 2010 for GPLIB++ by  doxygen 1.5.8