81 "There is no copy constructor or assignment operator for Random because you "
82 "probably didn't actually want to copy the state--it would "
83 "be slow and duplicate the state of a pseudo-random sequence. Maybe you could "
84 "provide arguments to a member variable in the constructor, "
85 "or pass the Random by reference?");
99 Random(
uint32 seed = 0xF018A4D2,
bool threadsafe =
true);
103 virtual void reset(
uint32 seed = 0xF018A4D2,
bool threadsafe =
true);
113 virtual inline float uniform(
float low,
float high) {
117 return low + (high - low) * ((
float)
bits() / (float)0xFFFFFFFFUL);
125 const float norm = 1.0f / (float)0xFFFFFFFFUL;
126 return (
float)
bits() * norm;
130 virtual float gaussian(
float mean,
float stdev);
134 virtual void cosHemi(
float&
x,
float&
y,
float&
z);
143 virtual void cosPowHemi(
const float k,
float&
x,
float&
y,
float&
z);
147 virtual void hemi(
float&
x,
float&
y,
float&
z);
150 virtual void sphere(
float&
x,
float&
y,
float&
z);
virtual void generate()
Definition: Random.cpp:85
virtual uint32 bits()
Definition: Random.cpp:51
Spinlock lock
Definition: Random.h:58
virtual void hemi(float &x, float &y, float &z)
Definition: Random.cpp:205
virtual float uniform()
Definition: Random.h:121
T max(const T &x, const T &y)
Definition: g3dmath.h:320
virtual float uniform(float low, float high)
Definition: Random.h:113
int index
Definition: Random.h:64
T min(const T &x, const T &y)
Definition: g3dmath.h:305
virtual void cosHemi(float &x, float &y, float &z)
Definition: Random.cpp:168
Random(const Random &r)
Definition: Random.h:89
virtual ~Random()
Definition: Random.cpp:45
virtual int integer(int min, int max)
Definition: Random.cpp:125
G3D::int16 z
Definition: Vector3int16.h:46
G3D::int16 y
Definition: Vector2int16.h:38
A mutual exclusion lock that busy-waits when locking.
Definition: GMutex.h:36
Random(void *)
Definition: Random.cpp:22
virtual float gaussian(float mean, float stdev)
Definition: Random.cpp:139
Random & operator=(const Random &)
Definition: Random.h:79
virtual void sphere(float &x, float &y, float &z)
Definition: Random.cpp:211
uint32_t uint32
Definition: g3dmath.h:168
G3D::int16 x
Definition: Vector2int16.h:37
#define alwaysAssertM(exp, message)
Definition: debugAssert.h:165
virtual void reset(uint32 seed=0xF018A4D2, bool threadsafe=true)
Definition: Random.cpp:33
static Random & common()
Definition: Random.cpp:16
uint32 * state
Definition: Random.h:61
virtual void cosPowHemi(const float k, float &x, float &y, float &z)
Definition: Random.cpp:191
virtual void cosSphere(float &x, float &y, float &z)
Definition: Random.cpp:159
bool m_threadsafe
Definition: Random.h:66