00001 00002 00008 00009 00011 // Include Guard 00012 #ifndef __ICERANDOM_H__ 00013 #define __ICERANDOM_H__ 00014 00015 FUNCTION ICECORE_API void SRand(udword seed); 00016 FUNCTION ICECORE_API udword Rand(); 00017 00019 inline_ float UnitRandomFloat() { return float(Rand()) * ONE_OVER_RAND_MAX; } 00020 00022 ICECORE_API udword GetRandomIndex(udword max_index); 00023 00024 class ICECORE_API BasicRandom 00025 { 00026 public: 00027 00029 inline_ BasicRandom(udword seed=0) : mRnd(seed) {} 00031 inline_ ~BasicRandom() {} 00032 00033 inline_ void SetSeed(udword seed) { mRnd = seed; } 00034 inline_ udword GetCurrentValue() const { return mRnd; } 00035 inline_ udword Randomize() { mRnd = mRnd * 2147001325 + 715136305; return mRnd; } 00036 00037 private: 00038 udword mRnd; 00039 }; 00040 00041 #endif // __ICERANDOM_H__ 00042