Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

/include/ZE_ZRandGen.h

Go to the documentation of this file.
00001 /*******************************************************************************
00002         This file is Part of the ZEngine Library for 2D game development.
00003                    Copyright (C) 2002, 2003 James Turk
00004 
00005                      Licensed under a BSD-style license.
00006 
00007     The maintainer of this library is James Turk (james@conceptofzero.net) 
00008      and the home of this Library is http://www.zengine.sourceforge.net
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 

Generated on Sun Oct 5 19:34:45 2003 for ZEngine by doxygen1.3