Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TRandom3.h
Go to the documentation of this file.
1// @(#)root/mathcore:$Id$
2// Author: Peter Malzacher 31/08/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_TRandom3
13#define ROOT_TRandom3
14
15
16
17//////////////////////////////////////////////////////////////////////////
18// //
19// TRandom3 //
20// //
21// random number generator class: Mersenne Twister //
22// //
23//////////////////////////////////////////////////////////////////////////
24
25#include "TRandom.h"
26
27class TRandom3 : public TRandom {
28
29private:
30 UInt_t fMt[624];
32
33public:
34 TRandom3(UInt_t seed=4357);
35 ~TRandom3() override;
36 /// Return one element of the generator state used to generate the random numbers.
37 /// Note that it is not the seed of the generator that was used in the SetSeed function and
38 /// the full state (624 numbers) is required to define the generator and have a reproducible output.
39 UInt_t GetSeed() const override { return fMt[fCount624 % 624];}
40 using TRandom::Rndm;
41 Double_t Rndm( ) override;
42 void RndmArray(Int_t n, Float_t *array) override;
43 void RndmArray(Int_t n, Double_t *array) override;
44 void SetSeed(ULong_t seed=0) override;
45 virtual const UInt_t *GetState() const { return fMt; }
46
47 ClassDefOverride(TRandom3,2) //Random number generator: Mersenne Twister
48};
49
51
52#endif
#define R__EXTERN
Definition DllImport.h:26
int Int_t
Definition RtypesCore.h:45
unsigned long ULong_t
Definition RtypesCore.h:55
float Float_t
Definition RtypesCore.h:57
double Double_t
Definition RtypesCore.h:59
#define ClassDefOverride(name, id)
Definition Rtypes.h:346
R__EXTERN TRandom * gRandom
Definition TRandom3.h:50
Random number generator class based on M.
Definition TRandom3.h:27
UInt_t fMt[624]
Definition TRandom3.h:30
Double_t Rndm() override
Machine independent random number generator.
Definition TRandom3.cxx:99
UInt_t GetSeed() const override
Return one element of the generator state used to generate the random numbers.
Definition TRandom3.h:39
void RndmArray(Int_t n, Float_t *array) override
Return an array of n random numbers uniformly distributed in ]0,1].
Definition TRandom3.cxx:143
Int_t fCount624
Definition TRandom3.h:31
virtual const UInt_t * GetState() const
Definition TRandom3.h:45
~TRandom3() override
Default destructor.
Definition TRandom3.cxx:90
void SetSeed(ULong_t seed=0) override
Set the random generator sequence if seed is 0 (default value) a TUUID is generated and used to fill ...
Definition TRandom3.cxx:206
This is the base class for the ROOT Random number generators.
Definition TRandom.h:27
Double_t Rndm() override
Machine independent random number generator.
Definition TRandom.cxx:559
const Int_t n
Definition legend1.C:16