CLHEP 2.4.6.4
C++ Class Library for High Energy Physics
Loading...
Searching...
No Matches
testZiggurat.cc
Go to the documentation of this file.
1//////////////////////////////////////////////////////////////////////////
2
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//_________________________________________________________________________
12int 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) {
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) {
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) {
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) {
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) {
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
static double shoot()
static double shoot()
Definition: RandGauss.cc:64
std::ofstream output("ranRestoreTest.cout")
int g(shared_ptr< X >)
int main()
Definition: testZiggurat.cc:12