Logo ROOT  
Reference Guide
TRandom.h
Go to the documentation of this file.
1 // @(#)root/mathcore:$Id$
2 // Author: Rene Brun 15/12/95
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TRandom
13 #define ROOT_TRandom
14 
15 #include "Math/TRandomEngine.h"
16 
17 //////////////////////////////////////////////////////////////////////////
18 // //
19 // TRandom //
20 // //
21 // Simple prototype random number generator class (periodicity = 10**9) //
22 // //
23 //////////////////////////////////////////////////////////////////////////
24 
25 #include "TNamed.h"
26 
27 class TRandom : public TNamed, public ROOT::Math::TRandomEngine {
28 
29 protected:
30  UInt_t fSeed; //Random number generator seed
31 
32 public:
33  TRandom(UInt_t seed=65539);
34  virtual ~TRandom();
35  virtual Int_t Binomial(Int_t ntot, Double_t prob);
37  virtual void Circle(Double_t &x, Double_t &y, Double_t r);
38  virtual Double_t Exp(Double_t tau);
39  virtual Double_t Gaus(Double_t mean=0, Double_t sigma=1);
40  virtual UInt_t GetSeed() const {return fSeed;}
41  virtual UInt_t Integer(UInt_t imax);
42  virtual Double_t Landau(Double_t mean=0, Double_t sigma=1);
43  virtual Int_t Poisson(Double_t mean);
44  virtual Double_t PoissonD(Double_t mean);
45  virtual void Rannor(Float_t &a, Float_t &b);
46  virtual void Rannor(Double_t &a, Double_t &b);
47  virtual void ReadRandom(const char *filename);
48  virtual void SetSeed(ULong_t seed=0);
49  virtual Double_t Rndm();
50  // keep for backward compatibility
51  virtual Double_t Rndm(Int_t ) { return Rndm(); }
52  virtual void RndmArray(Int_t n, Float_t *array);
53  virtual void RndmArray(Int_t n, Double_t *array);
54  virtual void Sphere(Double_t &x, Double_t &y, Double_t &z, Double_t r);
55  virtual Double_t Uniform(Double_t x1=1);
57  virtual void WriteRandom(const char *filename) const;
58 
59  ClassDef(TRandom,3) //Simple Random number generator (periodicity = 10**9)
60 };
61 
63 
64 #endif
ROOT::Math::Cephes::gamma
double gamma(double x)
Definition: SpecFuncCephes.cxx:339
n
const Int_t n
Definition: legend1.C:16
TRandom::GetSeed
virtual UInt_t GetSeed() const
Definition: TRandom.h:46
TRandom::Gaus
virtual Double_t Gaus(Double_t mean=0, Double_t sigma=1)
Samples a random number from the standard Normal (Gaussian) Distribution with the given mean and sigm...
Definition: TRandom.cxx:263
r
ROOT::R::TRInterface & r
Definition: Object.C:4
TNamed.h
TRandom::PoissonD
virtual Double_t PoissonD(Double_t mean)
Generates a random number according to a Poisson law.
Definition: TRandom.cxx:443
Float_t
float Float_t
Definition: RtypesCore.h:57
TRandom::fSeed
UInt_t fSeed
Definition: TRandom.h:36
Int_t
int Int_t
Definition: RtypesCore.h:45
TRandom::Uniform
virtual Double_t Uniform(Double_t x1=1)
Returns a uniform deviate on the interval (0, x1).
Definition: TRandom.cxx:635
x
Double_t x[n]
Definition: legend1.C:17
TRandom::WriteRandom
virtual void WriteRandom(const char *filename) const
Writes random generator status to filename.
Definition: TRandom.cxx:653
b
#define b(i)
Definition: RSha256.hxx:118
x1
static const double x1[5]
Definition: RooGaussKronrodIntegrator1D.cxx:346
TRandom::Rannor
virtual void Rannor(Float_t &a, Float_t &b)
Return 2 numbers distributed following a gaussian with mean=0 and sigma=1.
Definition: TRandom.cxx:489
ROOT::Math::TRandomEngine
Definition: TRandomEngine.h:29
TRandom::Sphere
virtual void Sphere(Double_t &x, Double_t &y, Double_t &z, Double_t r)
Generates random vectors, uniformly distributed over the surface of a sphere of given radius.
Definition: TRandom.cxx:617
TRandom::BreitWigner
virtual Double_t BreitWigner(Double_t mean=0, Double_t gamma=1)
Return a number distributed following a BreitWigner function with mean and gamma.
Definition: TRandom.cxx:214
TRandom::TRandom
TRandom(UInt_t seed=65539)
Default constructor. For seed see SetSeed().
Definition: TRandom.cxx:175
TRandom::Binomial
virtual Int_t Binomial(Int_t ntot, Double_t prob)
Generates a random integer N according to the binomial law.
Definition: TRandom.cxx:200
TRandom
Definition: TRandom.h:27
a
auto * a
Definition: textangle.C:12
TNamed
Definition: TNamed.h:29
TRandom::RndmArray
virtual void RndmArray(Int_t n, Float_t *array)
Return an array of n random numbers uniformly distributed in ]0,1].
Definition: TRandom.cxx:577
gRandom
R__EXTERN TRandom * gRandom
Definition: TRandom.h:62
TRandom::SetSeed
virtual void SetSeed(ULong_t seed=0)
Set the random generator seed.
Definition: TRandom.cxx:597
UInt_t
unsigned int UInt_t
Definition: RtypesCore.h:46
TRandom::Rndm
virtual Double_t Rndm()
Machine independent random number generator.
Definition: TRandom.cxx:541
TRandom::Landau
virtual Double_t Landau(Double_t mean=0, Double_t sigma=1)
Generate a random number following a Landau distribution with location parameter mu and scale paramet...
Definition: TRandom.cxx:369
y
Double_t y[n]
Definition: legend1.C:17
TRandom::ReadRandom
virtual void ReadRandom(const char *filename)
Reads saved random generator status from filename.
Definition: TRandom.cxx:519
ULong_t
unsigned long ULong_t
Definition: RtypesCore.h:55
TRandom::Integer
virtual UInt_t Integer(UInt_t imax)
Returns a random integer uniformly distributed on the interval [ 0, imax-1 ].
Definition: TRandom.cxx:349
unsigned int
sigma
const Double_t sigma
Definition: h1analysisProxy.h:11
TRandomEngine.h
Double_t
double Double_t
Definition: RtypesCore.h:59
TRandom::Circle
virtual void Circle(Double_t &x, Double_t &y, Double_t r)
Generates random vectors, uniformly distributed over a circle of given radius.
Definition: TRandom.cxx:228
TRandom::Poisson
virtual Int_t Poisson(Double_t mean)
Generates a random integer N according to a Poisson law.
Definition: TRandom.cxx:391
TRandom::~TRandom
virtual ~TRandom()
Default destructor.
Definition: TRandom.cxx:184
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
x2
static const double x2[5]
Definition: RooGaussKronrodIntegrator1D.cxx:364
R__EXTERN
#define R__EXTERN
Definition: DllImport.h:27
TRandom::Exp
virtual Double_t Exp(Double_t tau)
Returns an exponential deviate.
Definition: TRandom.cxx:240
int