22int quasirandom(
int n = 10000,
int skip = 0) {
24 TH2D * h0 =
new TH2D(
"h0",
"Pseudo-random Sequence",200,0,1,200,0,1);
25 TH2D *
h1 =
new TH2D(
"h1",
"Sobol Sequence",200,0,1,200,0,1);
26 TH2D *
h2 =
new TH2D(
"h2",
"Niederrer Sequence",200,0,1,200,0,1);
39 for (
int i = 0; i <
n; ++i) {
43 std::cout <<
"Time for gRandom ";
47 if( skip>0) r1.Skip(skip);
48 for (
int i = 0; i <
n; ++i) {
52 std::cout <<
"Time for Sobol ";
56 if( skip>0) r2.Skip(skip);
57 for (
int i = 0; i <
n; ++i) {
61 std::cout <<
"Time for Niederreiter ";
85 if (
h2->GetBinContent(i,j) == 0 ) nzerobins2++;
89 std::cout <<
"number of empty bins for pseudo-random = " << nzerobins0 << std::endl;
90 std::cout <<
"number of empty bins for " << r1.Name() <<
"\t= " << nzerobins1 << std::endl;
91 std::cout <<
"number of empty bins for " << r2.Name() <<
"\t= " << nzerobins2 << std::endl;
94 if (nzerobins1 >= nzerobins0 ) iret += 1;
95 if (nzerobins2 >= nzerobins0 ) iret += 2;
User class for MathMore random numbers template on the Engine type.
Documentation for the Random class.
void RndmArray(int n, double *array)
Generate an array of random numbers between ]0,1] 0 is excluded and 1 is included Function to preserv...
virtual Int_t GetNbinsY() const
virtual Int_t GetNbinsX() const
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
void Draw(Option_t *option="") override
Draw this histogram with options.
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
2-D histogram with a double per channel (see TH1 documentation)
Double_t GetBinContent(Int_t binx, Int_t biny) const override
Int_t Fill(Double_t) override
Invalid Fill method.
void Start(Bool_t reset=kTRUE)
Start the stopwatch.