3 // Random number geerator
5 #ifndef CPPUNIT_MEMORY_RANDOM_GEN_H
6 #define CPPUNIT_MEMORY_RANDOM_GEN_H
9 #include <boost/random/mersenne_twister.hpp>
10 #include <boost/random/uniform_int.hpp>
11 #include <boost/random/variate_generator.hpp>
17 boost::mt19937 m_rndGen;
19 typedef T random_type;
24 random_type gen( random_type nMin, random_type nMax )
26 boost::uniform_int<random_type> dist(nMin, nMax);
27 return boost::variate_generator<boost::mt19937&, boost::uniform_int<random_type> >(m_rndGen, dist)();
31 random_type operator()()
33 return gen( s_nMinBlockSize, s_nMaxBlockSize );
37 random_type operator()( random_type nMin, random_type nMax )
39 return gen( nMin, nMax );
44 #endif // CPPUNIT_MEMORY_RANDOM_GEN_H