prime/include/Kyoto/CRandom16.hpp

35 lines
717 B
C++

#ifndef __CRANDOM16_HPP__
#define __CRANDOM16_HPP__
#include "types.h"
class CRandom16;
class CGlobalRandom {
static CGlobalRandom* gCurrentGlobalRandom;
public:
CGlobalRandom(CRandom16& rnd);
~CGlobalRandom();
private:
CRandom16& mRandom;
bool mIsFirst;
CGlobalRandom* mPrev;
};
class CRandom16 {
friend class CGlobalRandom;
static CRandom16* gRandomNumber;
static void _SetRandomNumber(CRandom16* rnd);
public:
static CRandom16* GetRandomNumber();
CRandom16(uint seed = 99);
void SetSeed(uint seed);
int Range(int min, int max);
float Range(float min, float max);
int Next();
float Float();
private:
uint mSeed;
};
#endif // __CRANDOM16_HPP__