Logo ROOT   6.16/01
Reference Guide
RooRandom.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitCore *
4 * File: $Id: RooRandom.h,v 1.9 2007/05/11 09:11:30 verkerke Exp $
5 * Authors: *
6 * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
7 * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
8 * *
9 * Copyright (c) 2000-2005, Regents of the University of California *
10 * and Stanford University. All rights reserved. *
11 * *
12 * Redistribution and use in source and binary forms, *
13 * with or without modification, are permitted according to the terms *
14 * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
15 *****************************************************************************/
16#ifndef ROO_RANDOM
17#define ROO_RANDOM
18
19#include "Rtypes.h"
20#include "TRandom.h"
21
23
24class RooRandom {
25public:
26
27 virtual ~RooRandom() {} ;
28
29 static TRandom *randomGenerator();
30 static void setRandomGenerator(TRandom* gen);
31 static Double_t uniform(TRandom *generator= randomGenerator());
32 static void uniform(UInt_t dimension, Double_t vector[], TRandom *generator= randomGenerator());
33 static UInt_t integer(UInt_t max, TRandom *generator= randomGenerator());
34 static Double_t gaussian(TRandom *generator= randomGenerator());
35
37 static Bool_t quasi(UInt_t dimension, Double_t vector[],
39
40private:
42
43 static TRandom* _theGenerator; // random number generator
44 static RooQuasiRandomGenerator* _theQuasiGenerator; // quasi random number sequence generator
45
46 // free resources when library is unloaded
47 struct Guard { ~Guard(); };
48 static struct Guard guard;
49 friend struct RooRandom::Guard;
50
51 ClassDef(RooRandom,0) // Random number generator interface
52};
53
54#endif
unsigned int UInt_t
Definition: RtypesCore.h:42
bool Bool_t
Definition: RtypesCore.h:59
double Double_t
Definition: RtypesCore.h:55
#define ClassDef(name, id)
Definition: Rtypes.h:324
This class generates the quasi-random (aka "low discrepancy") sequence for dimensions up to 12 using ...
This class provides a static interface for generating random numbers.
Definition: RooRandom.h:24
static RooQuasiRandomGenerator * quasiGenerator()
Return a pointer to a singleton quasi-random generator implementation.
Definition: RooRandom.cxx:74
static struct Guard guard
Definition: RooRandom.h:48
static Bool_t quasi(UInt_t dimension, Double_t vector[], RooQuasiRandomGenerator *generator=quasiGenerator())
Return a quasi-random number in the range (0,1) using the Niederreiter base 2 generator described in ...
Definition: RooRandom.cxx:122
static Double_t uniform(TRandom *generator=randomGenerator())
Return a number uniformly distributed from (0,1)
Definition: RooRandom.cxx:84
static TRandom * _theGenerator
Definition: RooRandom.h:43
static UInt_t integer(UInt_t max, TRandom *generator=randomGenerator())
Return an integer uniformly distributed from [0,n-1].
Definition: RooRandom.cxx:102
static void setRandomGenerator(TRandom *gen)
set the random number generator; takes ownership of the object passed as parameter
Definition: RooRandom.cxx:64
static Double_t gaussian(TRandom *generator=randomGenerator())
Return a Gaussian random variable with mean 0 and variance 1.
Definition: RooRandom.cxx:111
static RooQuasiRandomGenerator * _theQuasiGenerator
Definition: RooRandom.h:44
static TRandom * randomGenerator()
Return a pointer to a singleton random-number generator implementation.
Definition: RooRandom.cxx:54
virtual ~RooRandom()
Definition: RooRandom.h:27
This is the base class for the ROOT Random number generators.
Definition: TRandom.h:27