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 
FUNCTION
#define FUNCTION
Definition: IcePreprocessor.h:83
BasicRandom::BasicRandom
inline_ BasicRandom(udword seed=0)
Constructor.
Definition: IceRandom.h:29
BasicRandom::mRnd
udword mRnd
Definition: IceRandom.h:38
udword
unsigned int udword
sizeof(udword) must be 4
Definition: IceTypes.h:65
ONE_OVER_RAND_MAX
#define ONE_OVER_RAND_MAX
Inverse of the max possible value returned by rand()
Definition: IceTypes.h:138
SRand
FUNCTION ICECORE_API void SRand(udword seed)
BasicRandom::SetSeed
inline_ void SetSeed(udword seed)
Definition: IceRandom.h:33
BasicRandom::Randomize
inline_ udword Randomize()
Definition: IceRandom.h:35
ICECORE_API
#define ICECORE_API
Definition: IcePreprocessor.h:73
Rand
FUNCTION ICECORE_API udword Rand()
BasicRandom
Definition: IceRandom.h:24
GetRandomIndex
ICECORE_API udword GetRandomIndex(udword max_index)
Returns a random index so that 0<= index < max_index.
BasicRandom::GetCurrentValue
inline_ udword GetCurrentValue() const
Definition: IceRandom.h:34
inline_
#define inline_
Definition: IcePreprocessor.h:103
UnitRandomFloat
inline_ float UnitRandomFloat()
Returns a unit random floating-point value.
Definition: IceRandom.h:19
BasicRandom::~BasicRandom
inline_ ~BasicRandom()
Destructor.
Definition: IceRandom.h:31


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Wed Sep 7 2022 02:51:03