|
CbmRoot
|
A class, providing ROOT-free access to randomly generated variables. More...
#include <CaAlgoRandom.h>
Public Member Functions | |
| Random () | |
| Default constructor. | |
| Random (int seed) | |
| Constructor. | |
| ~Random ()=default | |
| Destructor. | |
| Random (const Random &other)=delete | |
| Copy constructor. | |
| Random (Random &&other)=delete | |
| Move constructor. | |
| Random & | operator= (const Random &)=delete |
| Copy assignment operator. | |
| Random & | operator= (Random &&)=delete |
| Move assignment operator. | |
| int | GetSeed () const |
| Gets seed of the random generator. | |
| void | SetSeed (int seed) |
| Sets seed to the random generator. | |
| template<typename T, std::enable_if_t< std::is_floating_point< T >::value, bool > = true> | |
| T | BoundedGaus (const T &mean, const T &sigma, const T &nSigmas) const |
| Returns a normally distributed random value, limited within a selected sigma range. | |
| template<typename T, std::enable_if_t< std::is_floating_point< T >::value, bool > = true> | |
| T | Uniform (const T &mean, const T &sigma) const |
| Returns a random value, addressed with a continuous uniform distribution. | |
Private Types | |
| using | GeneratorType_t = std::mt19937_64 |
Private Attributes | |
| GeneratorType_t | fGenerator |
| Random number generator. | |
| unsigned int | fSeed = 1 |
| Random number seed. | |
A class, providing ROOT-free access to randomly generated variables.
Definition at line 22 of file CaAlgoRandom.h.
|
private |
Definition at line 23 of file CaAlgoRandom.h.
| Random::Random | ( | ) |
Default constructor.
Sets seed equal to 1
Definition at line 17 of file CaAlgoRandom.cxx.
References Random().
Referenced by operator=(), operator=(), Random(), Random(), and Random().
| Random::Random | ( | int | seed | ) |
Constructor.
| seed | A random seed |
If 0 is selected for the random seed, the generator is seeded with std::random_device
Definition at line 21 of file CaAlgoRandom.cxx.
References SetSeed().
|
default |
Destructor.
| T cbm::algo::ca::Random::BoundedGaus | ( | const T & | mean, |
| const T & | sigma, | ||
| const T & | nSigmas ) const |
Returns a normally distributed random value, limited within a selected sigma range.
| T | Type of floating point numbers |
| mean | Mean of the distribution |
| sigma | Sigma of the distribution |
| nSigmas | Half-width of the generated numbers domain, expressed in number of sigmas |
Definition at line 90 of file CaAlgoRandom.h.
References fGenerator.
|
inline |
Copy assignment operator.
References Random().
Move assignment operator.
References Random().
| void Random::SetSeed | ( | int | seed | ) |
Sets seed to the random generator.
| seed | A random seed |
If 0 is selected for the random seed, the generator is seeded with std::random_device
Definition at line 25 of file CaAlgoRandom.cxx.
References fGenerator, and fSeed.
Referenced by Random().
| T cbm::algo::ca::Random::Uniform | ( | const T & | mean, |
| const T & | sigma ) const |
Returns a random value, addressed with a continuous uniform distribution.
| T | Type of floating point numbers |
| mean | Mean of the distribution |
| sigma | Sigma of the distribution |
Definition at line 106 of file CaAlgoRandom.h.
References fGenerator.
|
mutableprivate |
Random number generator.
Definition at line 78 of file CaAlgoRandom.h.
Referenced by BoundedGaus(), SetSeed(), and Uniform().
|
private |
Random number seed.
Definition at line 79 of file CaAlgoRandom.h.