#include <iostream>
#include <cmath>
#include <stdlib.h>
#include "CLHEP/Random/Ranlux64Engine.h"
Go to the source code of this file.
◆ check_sequence()
Definition at line 59 of file testBug73093.cc.
60{
61
62
63 std::ofstream
output(
"testBug73093.seq");
64 int bad = 0;
65 long seed;
66 long mult=-235421;
67
68 for( int il=0; il<50; ++il ) {
69 seed = 97654321;
70 seed += il*mult;
71
73 const long N = 20;
74
76
77 double __attribute__ ((unused)) sum = 0;
78 for (long i=0; i<N; ++i) {
79 double r = rng.
flat();
80 if( std::abs(r) > 1.0 ) ++bad;
81 output <<
"[" << il <<
"][" << i <<
"] = " << r <<
";" << std::endl;
82 sum += r;
83 }
84 }
85 return bad;
86}
void setSeed(long seed, int lxr=1)
std::ofstream output("ranRestoreTest.cout")
Referenced by main().
◆ main()
Definition at line 88 of file testBug73093.cc.
89{
90
91 int bad = 0;
94
95 return bad;
96}
◆ valid_range()
Definition at line 16 of file testBug73093.cc.
17{
18 std::ofstream
output(
"testBug73093.cout");
19
20 int bad = 0;
21 long seed;
22 long mult=-235421;
23
24 for( int il=0; il<100; ++il ) {
25 if( sizeof(long) > 4 ) {
26
27 seed = atol("9899876543210000");
28 mult = mult + atol("120034020050070");
29 } else {
30 seed = 987654321;
31 mult = mult + 12003400;
32 }
33 seed += il*mult;
34
36 const long N = 20;
37
40 output <<
"sizeof(long) = " <<
sizeof(long) << std::endl;
41 output <<
"Generating " << N <<
" random numbers with seed " << seed << std::endl;
42 output <<
"Using seed " << seed << std::endl;
43
44 double sum(0);
45 for (long i=0; i<N; ++i) {
46 double r = rng.
flat();
47 if( std::abs(r) > 1.0 ) ++bad;
49 sum += r;
50 }
51
52 output <<
"Sum: " << sum << std::endl;
53 output <<
"Average: " << sum / N << std::endl;
54 }
55
56 return bad;
57}
Referenced by main().