57 #ifdef R__COMPLETE_MEM_TERMINATION
59 struct TRandomCleanup {
60 ~TRandomCleanup() {
delete gRandom; gRandom = 0; }
62 static TRandomCleanup gCleanupRandom;
76 SetTitle(
"Random number generator: Mersenne Twister");
99 const UInt_t kTemperingMaskB = 0x9d2c5680;
100 const UInt_t kTemperingMaskC = 0xefc60000;
101 const UInt_t kUpperMask = 0x80000000;
102 const UInt_t kLowerMask = 0x7fffffff;
103 const UInt_t kMatrixA = 0x9908b0df;
105 if (fCount624 >= kN) {
108 for (i=0; i < kN-kM; i++) {
109 y = (
fMt[i] & kUpperMask) | (
fMt[i+1] & kLowerMask);
110 fMt[i] =
fMt[i+kM] ^ (y >> 1) ^ ((y & 0
x1) ? kMatrixA : 0x0);
113 for ( ; i < kN-1 ; i++) {
114 y = (
fMt[i] & kUpperMask) | (
fMt[i+1] & kLowerMask);
115 fMt[i] =
fMt[i+kM-kN] ^ (y >> 1) ^ ((y & 0
x1) ? kMatrixA : 0x0);
118 y = (
fMt[kN-1] & kUpperMask) | (
fMt[0] & kLowerMask);
119 fMt[kN-1] =
fMt[kM-1] ^ (y >> 1) ^ ((y & 0
x1) ? kMatrixA : 0x0);
123 y =
fMt[fCount624++];
125 y ^= ((y << 7 ) & kTemperingMaskB );
126 y ^= ((y << 15) & kTemperingMaskC );
130 if (y)
return ( (
Double_t) y * 2.3283064365386963e-10);
151 const Int_t kM = 397;
152 const Int_t kN = 624;
153 const UInt_t kTemperingMaskB = 0x9d2c5680;
154 const UInt_t kTemperingMaskC = 0xefc60000;
155 const UInt_t kUpperMask = 0x80000000;
156 const UInt_t kLowerMask = 0x7fffffff;
157 const UInt_t kMatrixA = 0x9908b0df;
160 if (fCount624 >= kN) {
163 for (i=0; i < kN-kM; i++) {
164 y = (
fMt[i] & kUpperMask) | (
fMt[i+1] & kLowerMask);
165 fMt[i] =
fMt[i+kM] ^ (y >> 1) ^ ((y & 0
x1) ? kMatrixA : 0x0);
168 for ( ; i < kN-1 ; i++) {
169 y = (
fMt[i] & kUpperMask) | (
fMt[i+1] & kLowerMask);
170 fMt[i] =
fMt[i+kM-kN] ^ (y >> 1) ^ ((y & 0
x1) ? kMatrixA : 0x0);
173 y = (
fMt[kN-1] & kUpperMask) | (
fMt[0] & kLowerMask);
174 fMt[kN-1] =
fMt[kM-1] ^ (y >> 1) ^ ((y & 0
x1) ? kMatrixA : 0x0);
178 y =
fMt[fCount624++];
180 y ^= ((y << 7 ) & kTemperingMaskB );
181 y ^= ((y << 15) & kTemperingMaskC );
185 array[k] =
Double_t( y * 2.3283064365386963e-10);
208 for(
Int_t i=1; i<624; i++) {
209 fMt[i] = (1812433253 * (
fMt[i-1] ^ (
fMt[i-1] >> 30)) + i );
218 for (
Int_t i = 0; i< 624; i++) {
231 void TRandom3::Streamer(
TBuffer &R__b)
241 TRandom::Streamer(R__b);
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
Random number generator class based on M.
virtual ~TRandom3()
*-*-*-*-*-*-*-*-*-*-*default destructor*-*-*-*-*-*-*-*-*-*-*-*-*-*-* *-* ================== ...
Random number generator class based on the maximally quidistributed combined Tausworthe generator by ...
virtual Double_t Rndm(Int_t i=0)
TausWorth generator from L'Ecuyer, uses as seed 3x32bits integers Use a mask of 0xffffffffUL to make ...
Buffer base class used for serializing objects.
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
virtual void SetSeed(UInt_t seed=0)
Set the random generator seed.
virtual Int_t ReadStaticArray(Bool_t *b)=0
This is the base class for the ROOT Random number generators.
virtual Double_t Rndm(Int_t i=0)
Machine independent random number generator.
virtual void SetSeed(UInt_t seed=0)
Set the random generator sequence if seed is 0 (default value) a TUUID is generated and used to fill ...
virtual void RndmArray(Int_t n, Float_t *array)
Return an array of n random numbers uniformly distributed in ]0,1].
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
static const double x1[5]
ClassImp(TRandom3) TRandom3
*-*-*-*-*-*-*-*-*-*-*default constructor*-*-*-*-*-*-*-*-*-*-*-*-*-*-* If seed is 0, the seed is automatically computed via a TUUID object.
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0