Logo ROOT   6.13/01
Reference Guide
TRandom1.h
Go to the documentation of this file.
1 // @(#)root/mathcore:$Id$
2 // Author: Rene Brun 04/03/99
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_TRandom1
13 #define ROOT_TRandom1
14 
15 
16 
17 //////////////////////////////////////////////////////////////////////////
18 // //
19 // TRandom1 //
20 // //
21 // Ranlux random number generator class (periodicity > 10**14) //
22 // //
23 //////////////////////////////////////////////////////////////////////////
24 
25 #include "TRandom.h"
26 
27 class TRandom1 : public TRandom {
28 
29 protected:
30  Int_t fNskip;
31  Int_t fLuxury;
32  Int_t fIlag;
33  Int_t fJlag;
34  Int_t fCount24;
35  Float_t fFloatSeedTable[24];
36  Float_t fCarry;
37  const Int_t fIntModulus;
38  static Int_t fgNumEngines;
39  static Int_t fgMaxIndex;
40  const UInt_t *fTheSeeds;
41  const Double_t fMantissaBit24;
42  const Double_t fMantissaBit12;
43 
44 public:
45  TRandom1();
46  TRandom1(UInt_t seed, Int_t lux = 3 );
47  TRandom1(Int_t rowIndex, Int_t colIndex, Int_t lux );
48  virtual ~TRandom1();
49  virtual Int_t GetLuxury() const {return fLuxury;}
50  // Get the current seed (first element of the table)
51  virtual UInt_t GetSeed() const { return UInt_t ( fFloatSeedTable[0] / fMantissaBit24 ) ; }
52  // Gets the current seed.
53  const UInt_t *GetTheSeeds() const {return fTheSeeds;}
54  // Gets the current array of seeds.
55  static void GetTableSeeds(UInt_t* seeds, Int_t index);
56  // Gets back seed values stored in the table, given the index.
57  using TRandom::Rndm;
58  virtual Double_t Rndm( );
59  virtual void RndmArray(Int_t size, Float_t *vect);
60  virtual void RndmArray(Int_t size, Double_t *vect);
61  virtual void SetSeed2(UInt_t seed, Int_t lux=3);
62  // Sets the state of the algorithm according to seed.
63  virtual void SetSeeds(const UInt_t * seeds, Int_t lux=3);
64  // Sets the state of the algorithm according to the zero terminated
65  // array of seeds. Only the first seed is used.
66  virtual void SetSeed(ULong_t seed);
67 
68  ClassDef(TRandom1,1) //Ranlux Random number generators with periodicity > 10**14
69 };
70 
71 R__EXTERN TRandom *gRandom;
72 
73 #endif
const UInt_t * fTheSeeds
Definition: TRandom1.h:40
Int_t fIlag
Definition: TRandom1.h:32
virtual void SetSeed2(UInt_t seed, Int_t lux=3)
The initialisation is carried out using a Multiplicative Congruential generator using formula constan...
Definition: TRandom1.cxx:555
virtual void RndmArray(Int_t size, Float_t *vect)
return an array of random numbers in ]0,1]
Definition: TRandom1.cxx:413
const UInt_t * GetTheSeeds() const
Definition: TRandom1.h:53
Float_t fCarry
Definition: TRandom1.h:36
virtual Double_t Rndm()
return a random number in ]0,1]
Definition: TRandom1.cxx:360
const Int_t fIntModulus
Definition: TRandom1.h:37
virtual void SetSeeds(const UInt_t *seeds, Int_t lux=3)
set seeds
Definition: TRandom1.cxx:478
The Ranlux Random number generator class.
Definition: TRandom1.h:27
This is the base class for the ROOT Random number generators.
Definition: TRandom.h:27
TRandom1()
default constructor
Definition: TRandom1.cxx:287
virtual ~TRandom1()
destructor
Definition: TRandom1.cxx:341
Int_t fCount24
Definition: TRandom1.h:34
Int_t fJlag
Definition: TRandom1.h:33
virtual Int_t GetLuxury() const
Definition: TRandom1.h:49
const Double_t fMantissaBit12
Definition: TRandom1.h:42
Int_t fLuxury
Definition: TRandom1.h:31
virtual Double_t Rndm()
Machine independent random number generator.
Definition: TRandom.cxx:533
const Double_t fMantissaBit24
Definition: TRandom1.h:41
Float_t fFloatSeedTable[24]
Definition: TRandom1.h:35
virtual UInt_t GetSeed() const
Definition: TRandom1.h:51
virtual void SetSeed(ULong_t seed)
Set the random generator seed.
Definition: TRandom1.cxx:619
static Int_t fgNumEngines
Definition: TRandom1.h:38
R__EXTERN TRandom * gRandom
Definition: TRandom1.h:71
static void GetTableSeeds(UInt_t *seeds, Int_t index)
static function returning the table of seeds
Definition: TRandom1.cxx:348
static Int_t fgMaxIndex
Definition: TRandom1.h:39
Int_t fNskip
Definition: TRandom1.h:30