forked from pazdera/libcity
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrandom.h
63 lines (51 loc) · 1.12 KB
/
random.h
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/**
* This code is part of libcity library.
*
* @file random.h
* @date 23.03.2011
* @author Radek Pazdera ([email protected])
*
* @brief Random number generator class.
*
*/
#ifndef _RANDOM_H_
#define _RANDOM_H_
namespace libcity
{
const unsigned int RANDOM_SEED = 5;
}
class Random
{
private:
static unsigned int seed;
public:
static void setSeed(int newSeed);
/* Static factories of different configurations */
static Random doubleValue(double lower, double higher);
static Random integerValue(int lower, int higher);
static Random boolValue(double chance);
Random();
Random(double ownSeed);
~Random();
double generateDouble(double lower, double higher);
int generateInteger(int lower, int higher);
bool generateBool(double chance);
double generate();
private:
double base();
bool useOwnSeed;
unsigned int state;
/* For value objects */
enum values
{
NONE,
DOUBLE_VALUE,
INTEGER_VALUE,
BOOL_VALUE
};
values configuration;
double lowerBound;
double higherBound;
double probability;
};
#endif