-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathrndexp.h
41 lines (28 loc) · 1.06 KB
/
rndexp.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
#ifndef _RNDEXP_INCL
#define _RNDEXP_INCL
using namespace std;
#include "rnd.h"
class RNDEXP: public RND
{
// Members: ********************************************
private:
double Mean; // theoretical mean
double Var; // theoretical variance
double Factor; // dummy
// Methods: ********************************************
public:
// Constructor *****************************************
RNDEXP(double mean)
{ Mean = mean; Var = mean * mean; Factor = -mean; }
// margins *********************************************
double GetMinRndValue()
{ return log(RND::GetMaxRndValue()) * Factor; }
double GetMaxRndValue()
{ return log(RND::GetMinRndValue()) * Factor; }
// public generators ***********************************
double Rnd()
{ return log(1.0-Rnd01()) * Factor; }
// friend: output operator *****************************
friend ostream& operator<<(ostream& outp, RNDEXP& gen);
};
#endif