00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00024 #ifndef __ze_zrandgen_h__
00025 #define __ze_zrandgen_h__
00026
00027 #include "ZE_Utility.h"
00028 #include <ctime>
00029
00030 namespace ZE
00031 {
00032
00042 class ZRandGen
00043 {
00044 protected:
00046 static const unsigned long N = 624;
00048 static const unsigned long M = 397;
00050 static const unsigned long MATRIX_A = 0x9908b0dfUL;
00052 static const unsigned long UPPER_MASK = 0x80000000UL;
00054 static const unsigned long LOWER_MASK = 0x7fffffffUL;
00055
00057 unsigned long rStateVector[N];
00059 unsigned long rStateVectorIndex;
00060
00068 unsigned long genrand_int32();
00069
00070 public:
00076 ZRandGen();
00077
00083 ZRandGen(unsigned long seed);
00084
00091 void Seed(unsigned long seed);
00092
00100 unsigned int Rand(unsigned int max);
00101
00109 unsigned long Rand(unsigned long max);
00110
00119 int Rand(int min, int max);
00120
00129 long Rand(long min, long max);
00130
00139 float Rand(float min, float max);
00140
00149 double Rand(double min, double max);
00150
00157 double RandDouble();
00158 };
00159
00160 }
00161
00162 #endif //__ze_zrandgen_h__
00163