#include <UseRandom.h>
Public Member Functions | |
UseRandom () | |
Default constructor does nothing. | |
UseRandom (const UseRandom &) | |
Copy-constructor does nothing. | |
UseRandom (const RanGenPtr &r) | |
Construct a new object specifying a new RandomGenerator, r, to be used during this objects lifetime. | |
~UseRandom () | |
The destructor removing the RandomGenerator specified in the constructor from the stack. | |
Static Public Member Functions | |
static RandomGenerator & | current () |
Return a reference to the currently chosen RandomGenerator object. | |
static double | rnd () |
Return a pointer to the currently chosen RandomGenerator object. | |
static RandomGenerator::RndVector | rndvec (int n) |
Return n simple flat random number (from the current RandomGenerator object) in the range ]0,1[. | |
template<typename Unit> | |
static Unit | rnd (Unit xu) |
Return a simple flat random number (from the current RandomGenerator object) in the range ]0,xu[. | |
template<typename Unit> | |
static Unit | rnd (Unit xl, Unit xu) |
Return a simple flat random number (from the current RandomGenerator object) in the range ]xl,xu[. | |
static bool | rndbool (double p=0.5) |
Return a true with probability p (default 0.5). | |
static bool | rndbool (double p1, double p2) |
Return a true with probability p1/(p1+p2). | |
static int | rndsign (double p1, double p2, double p3) |
Return -1, 0, or 1 with relative probabilities p1, p2, p3. | |
static int | rnd2 (double p0, double p1) |
Return an integer with probability p/(p0+p1). | |
static int | rnd3 (double p0, double p1, double p2) |
Return an integer with probability p/(p0+p1+p2). | |
static int | rnd4 (double p0, double p1, double p2, double p3) |
Return an integer/ with probability p(p0+p1+p2+p3). | |
static long | irnd (long xu=2) |
Return a simple flat random integrer number in the range [0,xu[. | |
static long | irnd (long xl, long xu) |
Return a simple flat random integrer number in the range [xl,xu[. | |
static double | rndExp () |
Return a number between zero and infinity, distributed according to . | |
template<typename Unit> | |
static Unit | rndExp (Unit mean) |
Return a number between zero and infinity, distributed according to where is the mean value. | |
static double | rndGauss () |
Return a number distributed according to a Gaussian distribution with zero mean and unit variance. | |
template<typename Unit> | |
static Unit | rndGauss (Unit sigma, Unit mean=Unit()) |
Return a number distributed according to a Gaussian distribution with a given standard deviation, sigma, and a given mean. | |
template<typename Unit> | |
static Unit | rndBW (Unit mean, Unit gamma) |
Return a positive number distributed according to a non-relativistic Breit-Wigner with a given width, gamma, and a given mean. | |
template<typename Unit> | |
static Unit | rndBW (Unit mean, Unit gamma, Unit cut) |
Return a positive number distributed according to a non-relativistic Breit-Wigner with a given width, gamma, and a given mean. | |
template<typename Unit> | |
static Unit | rndRelBW (Unit mean, Unit gamma) |
Return a positive number distributed according to a relativistic Breit-Wigner with a given width, gamma, and a given mean. | |
template<typename Unit> | |
static Unit | rndRelBW (Unit mean, Unit gamma, Unit cut) |
Return a positive number distributed according to a relativistic Breit-Wigner with a given width, gamma, and a given mean. | |
static long | rndPoisson (double mean) |
Return a non-negative number generated according to a Poissonian distribution with a given mean. | |
Private Member Functions | |
UseRandom & | operator= (const UseRandom &) |
Private and non-existent assignment operator. | |
Private Attributes | |
bool | randomPushed |
True if this object is responsible for pushing a RandomGenerator onto the stack. | |
Static Private Attributes | |
static vector< RanGenPtr > | theRandomStack |
The stack of RandomGenerators requested. |
When an EventGenerator is initialized or run it adds a RandomGenerator object to the stack which can be used by any other object being initialized or run through the static functions of the UseRandom class. If someone needs to use an alternative RandomGenerator object a new UseRandom object can be constructed with a pointer to the desired RandomGenerator object as argument and that object will the be used by the static UseRandom functions until the UseRandom object is destructed.
Definition at line 33 of file UseRandom.h.
static double ThePEG::UseRandom::rnd | ( | ) | [inline, static] |
Return a pointer to the currently chosen RandomGenerator object.
Return a simple flat random number (from the current RandomGenerator object) in the range ]0,1[.
Definition at line 82 of file UseRandom.h.
References current(), and ThePEG::RandomGenerator::rnd().
Referenced by irnd().
static Unit ThePEG::UseRandom::rndBW | ( | Unit | mean, | |
Unit | gamma, | |||
Unit | cut | |||
) | [inline, static] |
Return a positive number distributed according to a non-relativistic Breit-Wigner with a given width, gamma, and a given mean.
The distribution is cut-off so that the number is between mean - cut and mean + cut
Definition at line 209 of file UseRandom.h.
References current(), and ThePEG::RandomGenerator::rndBW().
static Unit ThePEG::UseRandom::rndRelBW | ( | Unit | mean, | |
Unit | gamma, | |||
Unit | cut | |||
) | [inline, static] |
Return a positive number distributed according to a relativistic Breit-Wigner with a given width, gamma, and a given mean.
The distribution is cut-off so that the number is between mean - cut and mean + cut
Definition at line 229 of file UseRandom.h.
References current(), and ThePEG::RandomGenerator::rndRelBW().