prime/include/Kyoto/CRandom16.hpp

40 lines
667 B
C++
Raw Normal View History

#ifndef _CRANDOM16
#define _CRANDOM16
2022-07-30 10:34:28 +00:00
#include "types.h"
class CRandom16;
class CGlobalRandom {
2022-09-14 05:24:12 +00:00
static CGlobalRandom* gCurrentGlobalRandom;
2022-07-30 10:34:28 +00:00
public:
2022-09-14 05:24:12 +00:00
CGlobalRandom(CRandom16& rnd);
~CGlobalRandom();
2022-07-30 10:34:28 +00:00
private:
2022-09-14 05:24:12 +00:00
CRandom16& mRandom;
bool mIsFirst;
CGlobalRandom* mPrev;
2022-07-30 10:34:28 +00:00
};
class CRandom16 {
2022-09-14 05:24:12 +00:00
friend class CGlobalRandom;
static CRandom16* gRandomNumber;
static void _SetRandomNumber(CRandom16* rnd);
2022-07-30 10:34:28 +00:00
public:
2022-09-14 05:24:12 +00:00
CRandom16(uint seed = 99);
void SetSeed(uint seed);
int Range(int min, int max);
float Range(float min, float max);
int Next();
float Float();
static CRandom16* GetRandomNumber();
2022-07-30 10:34:28 +00:00
private:
2022-09-14 05:24:12 +00:00
uint mSeed;
2022-07-30 10:34:28 +00:00
};
#endif // _CRANDOM16