00001 #include <iostream>
00002
00003 using namespace std;
00004
00005 class RNG {
00006 private:
00007
00008 static const long N = 624;
00009 static const long _M = 397;
00010 static const unsigned long _MATRIX_A = 0x9908b0dfUL;
00011 static const unsigned long _UPPER_MASK = 0x80000000UL;
00012 static const unsigned long _LOWER_MASK = 0x7fffffffUL;
00013
00014 private:
00015 unsigned long mt[N];
00016 int mti;
00017
00018 public:
00019 RNG(unsigned long seed=5489UL);
00020 RNG(unsigned long *init_key, int key_length);
00021
00022 void seed(unsigned long seed);
00023
00024
00025 unsigned long getInt32();
00026
00027 long getInt31();
00028
00029 double getDoubleLR();
00030 float getFloatLR();
00031
00032 double getDoubleL();
00033 float getFloatL();
00034
00035 double getDouble();
00036 float getFloat();
00037 };