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