Djinni
2.2
|
00001 /* In the beginning, this was a complete rewrite of 00002 NISHIMURA Takuji and MATSUMOTO Makoto's C library for the 00003 Mersenne Twister. When we introduced a dependency on 00004 Boost in version 2.x, this file was put on the chopping 00005 block. Boost provides its own Mersenne Twister; why 00006 shouldn't we just use theirs? Hence, this class is now a 00007 thin compatibility wrapper around Boost's Twister. 00008 00009 (c) 2005, the University of Iowa; (c) 2009, Robert J. Hansen. 00010 This code is redistributable under the terms found in the 00011 LICENSE file. */ 00012 00013 #ifndef TWISTER_H 00014 #define TWISTER_H 00015 #include <sys/types.h> 00016 #include <boost/random.hpp> 00017 00019 00023 class Twister { 00024 public: 00025 static void reseed(u_int32_t seed = 4397) { Twister::mt.seed(seed); } 00027 static double generateDouble() { return Twister::rng(); } 00028 00029 static boost::mt19937 mt; 00030 static boost::uniform_real<> real; 00031 static boost::variate_generator<boost::mt19937&, boost::uniform_real<> > rng; 00032 static boost::random_number_generator<boost::variate_generator<boost::mt19937&, boost::uniform_real<> > > stl_rng; 00033 }; 00034 00035 #endif 00036