CLHEP VERSION Reference Documentation
CLHEP Home Page
CLHEP Documentation
CLHEP Bug Reports
Main Page
Namespaces
Classes
Files
File List
File Members
Random
test
testZiggurat.cc
Go to the documentation of this file.
1
3
#include <iostream>
4
5
#include "CLHEP/Random/RandGauss.h"
6
#include "CLHEP/Random/RandGaussQ.h"
7
#include "CLHEP/Random/RandExponential.h"
8
#include "CLHEP/Random/RandGaussZiggurat.h"
9
#include "CLHEP/Random/RandExpZiggurat.h"
10
11
//_________________________________________________________________________
12
int
main
() {
13
14
std::ofstream
output
(
"testZiggurat.cout"
);
15
16
int
ntest=10000000;
17
18
output <<
"DEBUG: ntest="
<<ntest<<std::endl;
19
20
double
sum_rnd1=0;
21
for
(
int
i=0;i<ntest;++i) {
22
double
g
=
CLHEP::RandGauss::shoot
();
23
sum_rnd1+=g;
24
}
25
sum_rnd1/=ntest;
26
output <<
"DEBUG: avg RandGauss="
<<sum_rnd1<<std::endl;
27
28
double
sum_rnd2=0;
29
for
(
int
i=0;i<ntest;++i) {
30
double
g
=
CLHEP::RandGaussQ::shoot
();
31
sum_rnd2+=g;
32
}
33
sum_rnd2/=ntest;
34
output <<
"DEBUG: avg RandGaussQ="
<<sum_rnd2<<std::endl;
35
36
double
sum_zig=0;
37
for
(
int
i=0;i<ntest;++i) {
38
double
g
=
CLHEP::RandGaussZiggurat::shoot
();
39
sum_zig+=g;
40
}
41
sum_zig/=ntest;
42
output <<
"DEBUG: avg RandGaussZiggurat="
<<sum_zig<<std::endl;
43
44
double
sum_exp=0;
45
for
(
int
i=0;i<ntest;++i) {
46
double
g
=
CLHEP::RandExponential::shoot
();
47
sum_exp+=g;
48
}
49
sum_exp/=ntest;
50
output <<
"DEBUG: avg RandExponential="
<<sum_exp<<std::endl;
51
52
double
sum_expZ=0;
53
for
(
int
i=0;i<ntest;++i) {
54
double
g
=
CLHEP::RandExpZiggurat::shoot
();
55
sum_expZ+=g;
56
}
57
sum_expZ/=ntest;
58
output <<
"DEBUG: avg RandExpZiggurat="
<<sum_expZ<<std::endl;
59
60
return
0;
61
}
62
63
main
int main()
Definition:
testZiggurat.cc:12
output
std::ofstream output("ranRestoreTest.cout")
CLHEP::RandGaussQ::shoot
static double shoot()
CLHEP::RandGaussZiggurat::shoot
static float shoot()
Definition:
Matrix/CLHEP/Random/RandGaussZiggurat.h:49
CLHEP::RandExpZiggurat::shoot
static float shoot()
Definition:
Matrix/CLHEP/Random/RandExpZiggurat.h:55
CLHEP::RandGauss::shoot
static double shoot()
Definition:
RandGauss.cc:61
CLHEP::RandExponential::shoot
static double shoot()
Definition:
RandExponential.cc:42
g
int g(shared_ptr< X >)
Definition:
testSharedPtrConvertible.cc:46
Generated on Sat Apr 26 2014 20:36:39 for CLHEP by
1.8.6