64#ifdef R__COMPLETE_MEM_TERMINATION
66 struct TRandomCleanup {
69 static TRandomCleanup gCleanupRandom;
83 SetTitle(
"Random number generator: Mersenne Twister");
103 const Int_t kM = 397;
104 const Int_t kN = 624;
105 const UInt_t kTemperingMaskB = 0x9d2c5680;
106 const UInt_t kTemperingMaskC = 0xefc60000;
107 const UInt_t kUpperMask = 0x80000000;
108 const UInt_t kLowerMask = 0x7fffffff;
109 const UInt_t kMatrixA = 0x9908b0df;
114 for (i=0; i < kN-kM; i++) {
115 y = (
fMt[i] & kUpperMask) | (
fMt[i+1] & kLowerMask);
116 fMt[i] =
fMt[i+kM] ^ (
y >> 1) ^ ((
y & 0x1) ? kMatrixA : 0x0);
119 for ( ; i < kN-1 ; i++) {
120 y = (
fMt[i] & kUpperMask) | (
fMt[i+1] & kLowerMask);
121 fMt[i] =
fMt[i+kM-kN] ^ (
y >> 1) ^ ((
y & 0x1) ? kMatrixA : 0x0);
124 y = (
fMt[kN-1] & kUpperMask) | (
fMt[0] & kLowerMask);
125 fMt[kN-1] =
fMt[kM-1] ^ (
y >> 1) ^ ((
y & 0x1) ? kMatrixA : 0x0);
131 y ^= ((
y << 7 ) & kTemperingMaskB );
132 y ^= ((
y << 15) & kTemperingMaskC );
136 if (
y)
return ( (
Double_t)
y * 2.3283064365386963e-10);
157 const Int_t kM = 397;
158 const Int_t kN = 624;
159 const UInt_t kTemperingMaskB = 0x9d2c5680;
160 const UInt_t kTemperingMaskC = 0xefc60000;
161 const UInt_t kUpperMask = 0x80000000;
162 const UInt_t kLowerMask = 0x7fffffff;
163 const UInt_t kMatrixA = 0x9908b0df;
169 for (i=0; i < kN-kM; i++) {
170 y = (
fMt[i] & kUpperMask) | (
fMt[i+1] & kLowerMask);
171 fMt[i] =
fMt[i+kM] ^ (
y >> 1) ^ ((
y & 0x1) ? kMatrixA : 0x0);
174 for ( ; i < kN-1 ; i++) {
175 y = (
fMt[i] & kUpperMask) | (
fMt[i+1] & kLowerMask);
176 fMt[i] =
fMt[i+kM-kN] ^ (
y >> 1) ^ ((
y & 0x1) ? kMatrixA : 0x0);
179 y = (
fMt[kN-1] & kUpperMask) | (
fMt[0] & kLowerMask);
180 fMt[kN-1] =
fMt[kM-1] ^ (
y >> 1) ^ ((
y & 0x1) ? kMatrixA : 0x0);
186 y ^= ((
y << 7 ) & kTemperingMaskB );
187 y ^= ((
y << 15) & kTemperingMaskC );
191 array[k] =
Double_t(
y * 2.3283064365386963e-10);
214 for(
Int_t i=1; i<624; i++) {
215 fMt[i] = (1812433253 * (
fMt[i-1] ^ (
fMt[i-1] >> 30)) + i );
224 for (
Int_t i = 0; i< 624; i++) {
225 fMt[i] =
static_cast<UInt_t> (4294967296.*
r.Rndm());
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
R__EXTERN TRandom * gRandom
Buffer base class used for serializing objects.
virtual Version_t ReadVersion(UInt_t *start=nullptr, UInt_t *bcnt=nullptr, const TClass *cl=nullptr)=0
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=nullptr)=0
virtual Int_t ReadStaticArray(Bool_t *b)=0
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
virtual void SetName(const char *name)
Set the name of the TNamed.
Random number generator class based on the maximally quidistributed combined Tausworthe generator by ...
Random number generator class based on M.
Double_t Rndm() override
Machine independent random number generator.
void RndmArray(Int_t n, Float_t *array) override
Return an array of n random numbers uniformly distributed in ]0,1].
TClass * IsA() const override
TRandom3(UInt_t seed=4357)
Default constructor If seed is 0, the seed is automatically computed via a TUUID object.
void Streamer(TBuffer &) override
Stream an object of class TRandom3.
~TRandom3() override
Default destructor.
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 ...
This is the base class for the ROOT Random number generators.
virtual void SetSeed(ULong_t seed=0)
Set the random generator seed.
void Streamer(TBuffer &) override
Stream an object of class TObject.