-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRandomNumberGenerator.h
More file actions
37 lines (24 loc) · 866 Bytes
/
RandomNumberGenerator.h
File metadata and controls
37 lines (24 loc) · 866 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef _RANDOM_NUMBER_GENERATOR_H_
#define _RANDOM_NUMBER_GENERATOR_H_
class Vector4;
class RandomNumberGenerator
{
public:
RandomNumberGenerator();
~RandomNumberGenerator() {}
inline float uniform01(void);
inline float uniformRange(float min, float max);
void uniformSurfaceUnitSphere(float & x, float & y, float & z);
void uniformSurfaceUnitSphere(Vector4 & v);
void uniformSurfaceUnitHalfSphere(const Vector4 & half_space, Vector4 & v);
void uniformVolumeUnitSphere(float & x, float & y, float & z);
void seedCurrentTime();
private:
inline float uniform01Impl(void);
void buildCache();
static const unsigned int CACHE_SIZE = 1000;
unsigned int cache_next = CACHE_SIZE; // next available cache entry, or CACHE_SIZE if none left
float cache[CACHE_SIZE];
};
#include "RandomNumberGenerator.hpp"
#endif