source: issm/trunk-jpl/src/c/shared/Random/randomgenerator.h@ 26578

Last change on this file since 26578 was 26578, checked in by bulthuis, 3 years ago

BUG: Try to fix bugs on tests

  • Property svn:executable set to *
File size: 1.4 KB
Line 
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
11namespace rdngen{
12 class uniform_distribution_rnd
13 {
14
15 private:
16
17 unsigned int a; //multiplier of the linear congruential generator
18 unsigned int c; //increment of the linear congruential generator
19 unsigned int m; // modulo of the linear congruential generator
20 unsigned int _seed; // seed value
21 double lbound; // lower bound of uniform distribution
22 double ubound; // upper bound of uniform distribution
23
24 public:
25
26 /*constructors, destructors: */
27 uniform_distribution_rnd();
28 uniform_distribution_rnd(double a_1, double a_2);
29 ~uniform_distribution_rnd();
30
31 void seed( unsigned int s );
32 unsigned int get_seed();
33 double generator();
34
35 };
36
37 class normal_distribution_rnd
38 {
39
40 private:
41 unsigned int _seed; // seed value
42 double mean; // mean value
43 double sdev; // standard deviation
44
45 public:
46
47 /*constructors, destructors: */
48 normal_distribution_rnd();
49 normal_distribution_rnd(double m,double s);
50 ~normal_distribution_rnd();
51
52 void seed( unsigned int s );
53 double generator();
54
55 };
56
57}
58#endif //ifndef _RANDOMGENERATOR_H_
Note: See TracBrowser for help on using the repository browser.