1 | /*!\file: randomgenerator.h
|
---|
2 | * \brief prototypes for randomgenerator.h
|
---|
3 | */
|
---|
4 |
|
---|
5 | #ifndef _RANDOMGENERATOR_H_
|
---|
6 | #define _RANDOMGENERATOR_H_
|
---|
7 |
|
---|
8 | #undef M_PI
|
---|
9 | #define M_PI 3.141592653589793238462643
|
---|
10 |
|
---|
11 | class uniform_distribution_rnd
|
---|
12 | {
|
---|
13 |
|
---|
14 | private:
|
---|
15 |
|
---|
16 | unsigned int a; //multiplier of the linear congruential generator
|
---|
17 | unsigned int c; //increment of the linear congruential generator
|
---|
18 | unsigned int m; // modulo of the linear congruential generator
|
---|
19 | unsigned int _seed; // seed value
|
---|
20 | double lbound; // lower bound of uniform distribution
|
---|
21 | double ubound; // upper bound of uniform distribution
|
---|
22 |
|
---|
23 | public:
|
---|
24 |
|
---|
25 | /*constructors, destructors: */
|
---|
26 | uniform_distribution_rnd();
|
---|
27 | uniform_distribution_rnd(double a_1, double a_2);
|
---|
28 | ~uniform_distribution_rnd();
|
---|
29 |
|
---|
30 | void seed( unsigned int s );
|
---|
31 | unsigned int get_seed();
|
---|
32 | double generator();
|
---|
33 |
|
---|
34 | };
|
---|
35 |
|
---|
36 | class normal_distribution_rnd
|
---|
37 | {
|
---|
38 |
|
---|
39 | private:
|
---|
40 | unsigned int _seed; // seed value
|
---|
41 | double mean; // mean value
|
---|
42 | double sdev; // standard deviation
|
---|
43 |
|
---|
44 | public:
|
---|
45 |
|
---|
46 | /*constructors, destructors: */
|
---|
47 | normal_distribution_rnd();
|
---|
48 | normal_distribution_rnd(double m,double s);
|
---|
49 | ~normal_distribution_rnd();
|
---|
50 |
|
---|
51 | void seed( unsigned int s );
|
---|
52 | double generator();
|
---|
53 |
|
---|
54 | };
|
---|
55 |
|
---|
56 | #endif //ifndef _RANDOMGENERATOR_H_
|
---|