icemc
icemc_random.h
Go to the documentation of this file.
1 #ifndef icemc_random_h
2 #define icemc_random_h
3 
4 #include "TRandom.h"
5 
6 
7 
9 void setSeed(ULong_t seed);
10 
11 /* Convenience helper to get an RNG by name
12  *
13  * Right now there are far too many!
14  *
15  * */
17 {
29  RNG_NOISE, //might be merged with above?
41 };
42 
43 TRandom * getRNG(WhichIceMcRNG which);
44 
46 {
47 
49 #if ROOT_VERSION_CODE >= ROOT_VERSION(6,8,0)
52 #endif
54 };
55 
56 
58 void setRNGType(WhichIceMcRNGType type);
59 
60 
61 // Another RNG implemetatntion that supports 64-bit seeds
62 
63 class TRandomXoshiro256Plus : public TRandom
64 {
65 
66  private:
67  ULong_t fState[4];
68 
69 
70  public:
71  /* Initialize with seed */
72  TRandomXoshiro256Plus(ULong_t seed = 12345)
73  { SetSeed(seed) ; }
74 
75 
76  /*Initialize with state
77  **/
78  TRandomXoshiro256Plus(ULong_t state0, ULong_t state1, ULong_t state2, ULong_t state3)
79  {
80  fState[0] = state0;
81  fState[1] = state1;
82  fState[2] = state2;
83  fState[3] = state3;
84  }
85 
86  TRandomXoshiro256Plus(ULong_t * state)
87  {
88  fState[0] = state[0];
89  fState[1] = state[1];
90  fState[2] = state[2];
91  fState[3] = state[3];
92  }
93 
94  // this is obviously truncated
95  virtual UInt_t GetSeed() const { return fState[0]; }
96 
98  void getState(ULong_t * state) const { state[0] = fState[0]; state[1] = fState[1]; state[2] = fState[2]; state[3] = fState[3]; }
99  void getState(ULong_t & st0, ULong_t & st1, ULong_t & st2, ULong_t & st3) const { st0 = fState[0]; st1 = fState[1]; st2=fState[2]; st3=fState[3]; }
100 
101  virtual void SetSeed(ULong_t seed = 0);
102 
103  // This is the actual 64-bit value generated by the generator
104  virtual ULong_t RawRndm();
105  virtual Double_t Rndm();
106  virtual Double_t Rndm(Int_t unused) { (void) unused; return Rndm(); }
107  virtual void RndmArray(Int_t n, Float_t * array);
108  virtual void RndmArray(Int_t n, Double_t * array);
109 
111 };
112 
113 
114 
115 
116 #endif
Definition: icemc_random.h:34
Definition: icemc_random.h:19
Definition: icemc_random.h:31
virtual ULong_t RawRndm()
Definition: random.cc:37
Definition: icemc_random.h:26
Definition: icemc_random.h:48
Definition: icemc_random.h:27
TRandomXoshiro256Plus(ULong_t state0, ULong_t state1, ULong_t state2, ULong_t state3)
Definition: icemc_random.h:78
Definition: icemc_random.h:50
virtual Double_t Rndm()
Definition: random.cc:50
Definition: icemc_random.h:24
WhichIceMcRNGType
Definition: icemc_random.h:45
Definition: icemc_random.h:36
Definition: icemc_random.h:21
TRandomXoshiro256Plus(ULong_t seed=12345)
Definition: icemc_random.h:72
virtual Double_t Rndm(Int_t unused)
Definition: icemc_random.h:106
Definition: icemc_random.h:63
Definition: icemc_random.h:39
Definition: icemc_random.h:23
virtual void RndmArray(Int_t n, Float_t *array)
Definition: random.cc:76
Definition: icemc_random.h:29
WhichIceMcRNGType getRNGType()
Definition: random.cc:116
Definition: icemc_random.h:53
Definition: icemc_random.h:40
Definition: icemc_random.h:51
void setRNGType(WhichIceMcRNGType type)
Definition: random.cc:118
Definition: icemc_random.h:25
Definition: icemc_random.h:33
TRandomXoshiro256Plus(ULong_t *state)
Definition: icemc_random.h:86
void getState(ULong_t &st0, ULong_t &st1, ULong_t &st2, ULong_t &st3) const
Definition: icemc_random.h:99
TRandom * getRNG(WhichIceMcRNG which)
Definition: random.cc:143
Definition: icemc_random.h:35
virtual UInt_t GetSeed() const
Definition: icemc_random.h:95
ClassDef(TRandomXoshiro256Plus, 1)
Definition: icemc_random.h:38
Definition: icemc_random.h:30
Definition: icemc_random.h:18
ULong_t fState[4]
Definition: icemc_random.h:67
Definition: icemc_random.h:32
Definition: icemc_random.h:28
Definition: icemc_random.h:22
void setSeed(ULong_t seed)
Definition: random.cc:136
WhichIceMcRNG
Definition: icemc_random.h:16
void getState(ULong_t *state) const
Definition: icemc_random.h:98
virtual void SetSeed(ULong_t seed=0)
Definition: random.cc:56
Definition: icemc_random.h:37
Definition: icemc_random.h:20