StRoot
1
|
A class for providing random number generation. More...
#include <StarRandom.h>
Public Member Functions | |
Double_t | operator() () const |
Return a random number uniformly distributed between 0 and 1. | |
Double_t | operator() (const Double_t mn, const Double_t mx) const |
Return a random number uniformly distributed between mn and mx. | |
Double_t | operator() (Int_t *idummy) |
Double_t | flat () const |
Return a random number uniformly distributed between 0 and 1. | |
Double_t | flat (const Double_t mn, const Double_t mx) const |
Return a random number uniformly distributed between mn and mx. | |
Double_t | expo (const Double_t mu) const |
Return a random number distribted according to exp(-mu) | |
Double_t | landau () const |
Return a random number distributed according to a landau. | |
Double_t | gauss (const Double_t sigma) const |
Return a random number distributed according to a gaussian with specified sigma. | |
TVector2 | gauss2d (const Double_t sx, const Double_t sy, const Double_t rho) const |
Returns a pair of random numbers generated according to a 2D gaussian. | |
UInt_t | poisson (const Double_t mu) const |
Static Public Member Functions | |
static StarRandom & | Instance () |
Obtain the single instance of the random number generator. | |
static void | set (ROOT::Math::GSLRandomEngine *engine) |
Set the random number generator engine. | |
static void | capture () |
Capture gRandom random number generator. | |
static void | seed (UInt_t s) |
static void | seed (UShort_t seed1, UShort_t seed2) |
Protected Member Functions | |
ClassDef (StarRandom, 1) | |
Protected Attributes | |
UInt_t | mSeed |
TArrayC | mState |
Static Protected Attributes | |
static StarRandom * | sInstance = 0 |
static ROOT::Math::GSLRandomEngine * | mEngine = 0 |
A class for providing random number generation.
StarRandom is a singleton class which allows users to implement a common random number generator interface across multiple physics event generators.
Example: Remap pythia 6's random number generator
extern "C" { Double_t pyr( Int_t *idummy ){ return StarRandom::Instance().flat(); }; };
Definition at line 30 of file StarRandom.h.
UInt_t StarRandom::poisson | ( | const Double_t | mu | ) | const |
Returns an integer sampled from a possion distribution with expected value mu
Definition at line 79 of file StarRandom.cxx.
|
static |
Set the seed for this simulation. Note: Most RNG engines in GSL utilize a 32-bit seed. Those which use a smaller seed will take the provided seed modulo 32 bits. There may not be a warning issued when this occurs.
seed | is an unsigned integer (32-bit word) providing a seed for tne RNG. |
Definition at line 119 of file StarRandom.cxx.
References Instance().
Referenced by Instance(), and seed().
|
static |
Set a pair of seeds for this simulation. The two seeds will be combined into a single 32-bit word, and passed to the RNG engine.
seed1 | is the first RNG seed. |
seed2 | is the second RNG seed. |
Definition at line 126 of file StarRandom.cxx.
References seed().