src/biu/RandomNumberGenerator.hh
Go to the documentation of this file.00001 #ifndef RANDOMNUMBERGENERATOR_HH_ 00002 #define RANDOMNUMBERGENERATOR_HH_ 00003 00004 namespace biu { 00005 00012 class RandomNumberGenerator 00013 { 00014 protected: 00015 unsigned int seed; 00016 00017 public: 00022 RandomNumberGenerator(unsigned int seed_ = 1) : seed(seed_) {}; 00023 RandomNumberGenerator(RandomNumberGenerator& c) : seed(c.seed) {}; 00024 virtual ~RandomNumberGenerator() {}; 00025 00030 virtual void setSeed(unsigned int seed) = 0; 00031 00037 virtual unsigned int getRN() = 0; 00038 00043 virtual unsigned int getMaxRN() = 0; 00044 00049 virtual RandomNumberGenerator* copy(void) = 0; 00050 }; 00051 00061 class RNG_ISO : public RandomNumberGenerator 00062 { 00063 private: 00064 using RandomNumberGenerator::seed; 00065 00066 public: 00071 RNG_ISO(unsigned int seed = 1); 00072 virtual ~RNG_ISO(); 00073 00079 virtual void setSeed(unsigned int _seed); 00080 00085 virtual unsigned int getRN(); 00086 00090 virtual unsigned int getMaxRN(); 00091 00095 virtual RandomNumberGenerator* copy(void); 00096 }; 00097 00105 class RNG_LCG : public RandomNumberGenerator 00106 { 00107 private: 00108 using RandomNumberGenerator::seed; 00109 00110 public: 00115 RNG_LCG(unsigned int seed = 1); 00116 virtual ~RNG_LCG(); 00117 00121 virtual void setSeed(unsigned int _seed); 00122 00127 virtual unsigned int getRN(); 00128 00132 virtual unsigned int getMaxRN(); 00133 00137 virtual RandomNumberGenerator* copy(void); 00138 }; 00139 00140 } // end namespace biu 00141 00142 #endif /*RANDOMNUMBERGENERATOR_HH_*/