-
Notifications
You must be signed in to change notification settings - Fork 5
/
rndexp.cpp
49 lines (41 loc) · 1.1 KB
/
rndexp.cpp
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
#include <iostream>
#include "rndexp.h"
#include <stdio.h>
#include <math.h>
#include <iomanip>
#include <stdlib.h>
#include <time.h>
// output operator *****************************************************
ostream& operator<<(ostream& outp, RNDEXP& gen)
{
outp << "RNDEXP, EX = " << gen.Mean << ", VarX = " << gen.Var;
return outp;
}
// main program for a demonstration of generator output ****************
//#ifdef SINGLE
int main()
{ srand(time(NULL));
double mean;
double p;
int no;
cout << "mean? ";
cin >> mean;
cout << "no.? ";
cin >> no;
RNDEXP RM(mean);
cout << RM << endl;
cout << endl;
for (int i = 0; i < no; i++)
{
printf("%le", RM.Rnd());
cout <<setprecision(5)<<RM.Rnd();
if (i % 5 == 4)
cout << endl;
else
cout << "\t";
}
cout << "-> minimal random value: " << RM.GetMinRndValue() << endl;
cout << "-> maximal random value: " << RM.GetMaxRndValue() << endl;
return 0;
}
//#endif