 |
Belle II Software
release-05-02-19
|
39 class RandomGenerator:
public TRandom {
67 void setSeed(
const unsigned char* seed,
unsigned int n);
76 const std::vector<unsigned char>&
getSeed()
const {
return m_seed; }
116 Double_t
Rndm(Int_t) {
return Rndm(); }
126 void RndmArray(Int_t n, Double_t* array);
132 void RndmArray(Int_t n, ULong64_t* array);
159 void RndmArray(Int_t n,
unsigned char* array);
218 for (
int i = 0; i < n; ++i) array[i] =
random01();
224 for (
int i = 0; i < n; ++i) array[i] =
random01();
230 for (
int i = 0; i < n; ++i) array[i] =
random64();
239 if (n % 2) array[n - 1] =
random32();
249 #ifdef RANDOM_IEEE754
262 union { uint64_t i;
double d; } x;
267 x.i |= 0x3FF0000000000000ULL;
273 const uint64_t x =
random64() >> 12;
278 return x * 2.220446049250313080847263336181640625e-16;
@ c_independent
Don't use event info to generate state.
@ c_runDependent
Use experiment and run number to generate state.
EGeneratorMode getMode() const
Get the generator mode.
RandomGenerator(const std::string &name="Belle2 Random Generator")
Default constructor, does not initialize the generator.
uint32_t random32()
Generate one 32bit unsigned integer between 0 and UINT32_MAX (both inclusive)
@ c_eventDependent
Use experiment, run and event number to generate state.
virtual ~RandomGenerator()
Destructor to free the seed information.
void setState(int barrier)
Set the state of the random number generator.
Fast Random number Generator using on xorshift1024* [arXiv:1402.6246].
std::vector< unsigned char > m_seed
seed information
void setBarrier(int barrierIndex)
manually set the barrier index to a fixed value
EGeneratorMode m_mode
Current generator mode.
uint64_t random64()
Generate one 64bit unsigned integer between 0 and UINT64_MAX (both inclusive).
Abstract base class for different kinds of events.
void SetSeed(UInt_t)
override base class SetSeed to do nothing, we don't need it but it gets called by parent constructor
ClassDef(RandomGenerator, 2)
and the root dictionary macro needs to be documented as well :) Version 2: merge m_eventDependent and...
const std::vector< unsigned char > & getSeed() const
return the seed object
double random01()
Generate a random double value between 0 and 1, both limits excluded.
void setSeed(const unsigned char *seed, unsigned int n)
Set the seed information.
unsigned int m_index
currently active index in the internal state
Double_t Rndm()
Generate a random value in (0,1), both limits excluded.
EGeneratorMode
Generator mode: determines which information is used to generate the internal state.
void RndmArray(Int_t n, Float_t *array)
Fill an array of floats with random values in (0,1), both limits excluded.
uint64_t m_state[16]
Internal state of the random number generator.
int m_barrier
current barrier index.
void setMode(EGeneratorMode mode)
Set the generator mode.
void initialize()
set the State from event meta information like experiment, run, and event number.
int getBarrier() const
obtain the currently active barrier id
void barrier()
increase the barrier index.