Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooRandom Class Reference

This class provides a static interface for generating random numbers.

By default a private copy of TRandom3 is used to generate all random numbers.

Definition at line 24 of file RooRandom.h.

Classes

struct  Guard
 

Public Member Functions

virtual ~RooRandom ()
 
virtual TClassIsA () const
 
virtual void Streamer (TBuffer &)
 
void StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b)
 

Static Public Member Functions

static TClassClass ()
 
static const char * Class_Name ()
 
static constexpr Version_t Class_Version ()
 
static const char * DeclFileName ()
 
static double gaussian (TRandom *generator=randomGenerator())
 Return a Gaussian random variable with mean 0 and variance 1.
 
static UInt_t integer (UInt_t max, TRandom *generator=randomGenerator())
 Return an integer uniformly distributed from [0,n-1].
 
static bool quasi (UInt_t dimension, double vector[], RooQuasiRandomGenerator *generator=quasiGenerator())
 Return a quasi-random number in the range (0,1) using the Niederreiter base 2 generator described in Bratley, Fox, Niederreiter, ACM Trans.
 
static RooQuasiRandomGeneratorquasiGenerator ()
 Return a pointer to a singleton quasi-random generator implementation.
 
static TRandomrandomGenerator ()
 Return a pointer to a singleton random-number generator implementation.
 
static void setRandomGenerator (TRandom *gen)
 set the random number generator; takes ownership of the object passed as parameter
 
static double uniform (TRandom *generator=randomGenerator())
 Return a number uniformly distributed from (0,1)
 
static void uniform (UInt_t dimension, double vector[], TRandom *generator=randomGenerator())
 Fill the vector provided with random numbers uniformly distributed from (0,1)
 

Private Member Functions

 RooRandom ()
 

Static Private Attributes

static TRandom_theGenerator = nullptr
 random number generator
 
static RooQuasiRandomGenerator_theQuasiGenerator = nullptr
 quasi random number sequence generator
 
static struct Guard guard
 

Friends

struct RooRandom::Guard
 

#include <RooRandom.h>

Constructor & Destructor Documentation

◆ ~RooRandom()

virtual RooRandom::~RooRandom ( )
inlinevirtual

Definition at line 27 of file RooRandom.h.

◆ RooRandom()

RooRandom::RooRandom ( )
private

Member Function Documentation

◆ Class()

static TClass * RooRandom::Class ( )
static
Returns
TClass describing this class

◆ Class_Name()

static const char * RooRandom::Class_Name ( )
static
Returns
Name of this class

◆ Class_Version()

static constexpr Version_t RooRandom::Class_Version ( )
inlinestaticconstexpr
Returns
Version of this class

Definition at line 51 of file RooRandom.h.

◆ DeclFileName()

static const char * RooRandom::DeclFileName ( )
inlinestatic
Returns
Name of the file containing the class declaration

Definition at line 51 of file RooRandom.h.

◆ gaussian()

double RooRandom::gaussian ( TRandom generator = randomGenerator())
static

Return a Gaussian random variable with mean 0 and variance 1.

Definition at line 105 of file RooRandom.cxx.

◆ integer()

UInt_t RooRandom::integer ( UInt_t  max,
TRandom generator = randomGenerator() 
)
static

Return an integer uniformly distributed from [0,n-1].

Definition at line 96 of file RooRandom.cxx.

◆ IsA()

virtual TClass * RooRandom::IsA ( ) const
inlinevirtual
Returns
TClass describing current object

Definition at line 51 of file RooRandom.h.

◆ quasi()

bool RooRandom::quasi ( UInt_t  dimension,
double  vector[],
RooQuasiRandomGenerator generator = quasiGenerator() 
)
static

Return a quasi-random number in the range (0,1) using the Niederreiter base 2 generator described in Bratley, Fox, Niederreiter, ACM Trans.

Model. Comp. Sim. 2, 195 (1992).

Definition at line 116 of file RooRandom.cxx.

◆ quasiGenerator()

RooQuasiRandomGenerator * RooRandom::quasiGenerator ( )
static

Return a pointer to a singleton quasi-random generator implementation.

Creates the object the first time it is called.

Definition at line 68 of file RooRandom.cxx.

◆ randomGenerator()

TRandom * RooRandom::randomGenerator ( )
static

Return a pointer to a singleton random-number generator implementation.

Creates the object the first time it is called.

Definition at line 48 of file RooRandom.cxx.

◆ setRandomGenerator()

void RooRandom::setRandomGenerator ( TRandom gen)
static

set the random number generator; takes ownership of the object passed as parameter

Definition at line 58 of file RooRandom.cxx.

◆ Streamer()

virtual void RooRandom::Streamer ( TBuffer )
virtual

◆ StreamerNVirtual()

void RooRandom::StreamerNVirtual ( TBuffer ClassDef_StreamerNVirtual_b)
inline

Definition at line 51 of file RooRandom.h.

◆ uniform() [1/2]

double RooRandom::uniform ( TRandom generator = randomGenerator())
static

Return a number uniformly distributed from (0,1)

Definition at line 78 of file RooRandom.cxx.

◆ uniform() [2/2]

void RooRandom::uniform ( UInt_t  dimension,
double  vector[],
TRandom generator = randomGenerator() 
)
static

Fill the vector provided with random numbers uniformly distributed from (0,1)

Definition at line 87 of file RooRandom.cxx.

Friends And Related Symbol Documentation

◆ RooRandom::Guard

friend struct RooRandom::Guard
friend

Definition at line 49 of file RooRandom.h.

Member Data Documentation

◆ _theGenerator

TRandom * RooRandom::_theGenerator = nullptr
staticprivate

random number generator

Definition at line 43 of file RooRandom.h.

◆ _theQuasiGenerator

RooQuasiRandomGenerator * RooRandom::_theQuasiGenerator = nullptr
staticprivate

quasi random number sequence generator

Definition at line 44 of file RooRandom.h.

◆ guard

RooRandom::Guard RooRandom::guard
staticprivate

Definition at line 48 of file RooRandom.h.

Libraries for RooRandom:

The documentation for this class was generated from the following files: