![]() |
CosmoBolognaLib
Free Software C++/Python libraries for cosmological calculations
|
The class CustomDistributionRandomNumbers. More...
#include <RandomNumbers.h>
Public Member Functions | |
CustomDistributionRandomNumbers (const distribution_func func, const std::shared_ptr< void > modelInput, const std::vector< double > parameter, const int seed, const double MinVal=par::defaultDouble, const double MaxVal=-par::defaultDouble) | |
constructor More... | |
~CustomDistributionRandomNumbers ()=default | |
default destructor | |
void | set_seed (const int seed) |
set the random number generator seed More... | |
void | set_custom_distribution (const distribution_func func, const std::shared_ptr< void > modelInput, const std::vector< double > parameter) |
set parameters for interpolated distribution More... | |
double | operator() () |
extract number from the distribution More... | |
![]() | |
RandomNumbers ()=default | |
default constructor | |
RandomNumbers (const int seed, const double MinVal=par::defaultDouble, const double MaxVal=-par::defaultDouble) | |
constructor More... | |
virtual | ~RandomNumbers ()=default |
default destructor | |
void | set_seed (const int seed) |
set the random number generator seed More... | |
void | set_range (const double MinVal, const double MaxVal) |
set the range for the random number extraction More... | |
void | set_value (const double value) |
set the value for constant distribution More... | |
virtual void | set_mean (const double mean) |
set the mean for Poisson distribution More... | |
virtual void | set_mean_sigma (const double mean, const double sigma) |
set parameters for Normal distribution More... | |
virtual void | set_discrete_values (const std::vector< double > values, const std::vector< double > weights) |
set parameters for Discrete distribution More... | |
virtual void | set_interpolated_distribution (const std::vector< double > values, const std::vector< double > weights) |
set the parameters for the interpolated distribution More... | |
Protected Attributes | |
std::shared_ptr< UniformRandomNumbers > | m_uniform_generator |
Uniform random number generator. | |
distribution_func | m_func |
the probability distribution function | |
std::vector< double > | m_func_parameter |
parameters of the probability distribution function | |
std::shared_ptr< void > | m_func_modelInput |
pointer to the data possibly used to construct the probability the distribution function | |
double | m_normalization |
the distribution normalization | |
![]() | |
std::mt19937_64 | m_generator |
pseudo-random numbers generator | |
int | m_seed |
seed | |
double | m_MinVal |
minimum value to generate | |
double | m_MaxVal |
maximum value to generate | |
The class CustomDistributionRandomNumbers.
"Headers/RandomNumbers.h"
The base class to generate random numbers from an user-defined function
Definition at line 575 of file RandomNumbers.h.
cbl::random::CustomDistributionRandomNumbers::CustomDistributionRandomNumbers | ( | const distribution_func | func, |
const std::shared_ptr< void > | modelInput, | ||
const std::vector< double > | parameter, | ||
const int | seed, | ||
const double | MinVal = par::defaultDouble , |
||
const double | MaxVal = -par::defaultDouble |
||
) |
constructor
func | the probability distribution function |
modelInput | pointer to the data possibly used to construct the probability distribution function |
parameter | the parameters of the probability distribution function |
seed | the random number generator seed |
MinVal | minimum value |
MaxVal | maximum value |
Definition at line 280 of file RandomNumbers.cpp.
|
virtual |
extract number from the distribution
Implements cbl::random::RandomNumbers.
Definition at line 312 of file RandomNumbers.cpp.
|
virtual |
set parameters for interpolated distribution
func | the probability distribution function |
modelInput | pointer to the data possibly used to construct the probability distribution function |
parameter | the parameters of the probability distribution function |
Reimplemented from cbl::random::RandomNumbers.
Definition at line 299 of file RandomNumbers.cpp.
void cbl::random::CustomDistributionRandomNumbers::set_seed | ( | const int | seed | ) |
set the random number generator seed
seed | the random number generator seed |
Definition at line 290 of file RandomNumbers.cpp.