IceRandom.h
Go to the documentation of this file.
1 
8 
11 // Include Guard
12 #ifndef __ICERANDOM_H__
13 #define __ICERANDOM_H__
14 
15  FUNCTION ICECORE_API void SRand(udword seed);
17 
19  inline_ float UnitRandomFloat() { return float(Rand()) * ONE_OVER_RAND_MAX; }
20 
23 
25  {
26  public:
27 
29  inline_ BasicRandom(udword seed=0) : mRnd(seed) {}
32 
33  inline_ void SetSeed(udword seed) { mRnd = seed; }
34  inline_ udword GetCurrentValue() const { return mRnd; }
35  inline_ udword Randomize() { mRnd = mRnd * 2147001325 + 715136305; return mRnd; }
36 
37  private:
39  };
40 
41 #endif // __ICERANDOM_H__
42 
#define ONE_OVER_RAND_MAX
Inverse of the max possible value returned by rand()
Definition: IceTypes.h:138
inline_ ~BasicRandom()
Destructor.
Definition: IceRandom.h:31
udword mRnd
Definition: IceRandom.h:38
#define FUNCTION
FUNCTION ICECORE_API udword Rand()
#define inline_
FUNCTION ICECORE_API void SRand(udword seed)
#define ICECORE_API
inline_ BasicRandom(udword seed=0)
Constructor.
Definition: IceRandom.h:29
unsigned int udword
sizeof(udword) must be 4
Definition: IceTypes.h:65
inline_ udword Randomize()
Definition: IceRandom.h:35
inline_ float UnitRandomFloat()
Returns a unit random floating-point value.
Definition: IceRandom.h:19
inline_ void SetSeed(udword seed)
Definition: IceRandom.h:33
ICECORE_API udword GetRandomIndex(udword max_index)
Returns a random index so that 0<= index < max_index.
inline_ udword GetCurrentValue() const
Definition: IceRandom.h:34


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Sat May 8 2021 02:42:38