4.6.0
Freundlich's C++ toolkit
|
A wrapper for distributions.
A wrapped for distributions that draws its properties from Parameters. The capabilities provided by this class are almost the same as the random distribution requirements by the standard except it lacks a default constructor.
Parameters | Must be a class from fcppt::random::distribution::parameters |
Public Types | |
using | distribution_type = basic |
A self typedef required by the standard. | |
using | wrapped_distribution = typename Parameters::distribution |
The underlying distribution used. | |
using | result_type = typename Parameters::result_type |
The result type of applying this distribution. | |
using | param_type = Parameters |
The parameters type, required by the standard. | |
Public Member Functions | |
basic (param_type const ¶meters) | |
Constructs the distribution from the parameters type. | |
template<typename T1 , typename T2 > | |
basic (T1 const &p1, T2 const &p2) | |
Constructs the distribution from multiple parameters. | |
void | reset () |
Resets the underlying distribution. | |
param_type | param () const |
Returns the parameters used to construct the distribution. | |
void | param (param_type const ¶meters) |
Supplies new parameters to the distribution. | |
template<typename Rng > | |
result_type | operator() (Rng &generator) |
Draws a random number. | |
template<typename Rng > | |
result_type | operator() (Rng &generator, param_type const ¶meters) |
Draws a random number with parameters. | |
result_type | min () const |
The minimum value that can be produced. | |
result_type | max () const |
The maximum value that can be produced. | |
wrapped_distribution const & | distribution () const |
The underlying distribution. | |
Friends | |
template<typename Ch , typename Traits > | |
std::basic_istream< Ch, Traits > | operator>> (std::basic_istream< Ch, Traits >, basic &) |
using fcppt::random::distribution::basic< Parameters >::distribution_type = basic |
A self typedef required by the standard.
using fcppt::random::distribution::basic< Parameters >::param_type = Parameters |
The parameters type, required by the standard.
using fcppt::random::distribution::basic< Parameters >::result_type = typename Parameters::result_type |
The result type of applying this distribution.
using fcppt::random::distribution::basic< Parameters >::wrapped_distribution = typename Parameters::distribution |
The underlying distribution used.
|
explicit |
Constructs the distribution from the parameters type.
Constructs the distribution from parameters
parameters | The parameters to use |
fcppt::random::distribution::basic< Parameters >::basic | ( | T1 const & | p1, |
T2 const & | p2 ) |
Constructs the distribution from multiple parameters.
Constructs the distribution from p1 and p2, calling param_type(p1,p2)
p1 | The first parameter |
p2 | The second parameter |
T1 | A type compatible to the first parameter of param_type |
T2 | A type compatible to the second parameter of param_type |
|
nodiscard |
The underlying distribution.
|
nodiscard |
The maximum value that can be produced.
|
nodiscard |
The minimum value that can be produced.
|
nodiscard |
Draws a random number.
Draws a random number from the underlying distribution by using generator
Rng | Must be a random generator |
generator | The random generator to use |
|
nodiscard |
Draws a random number with parameters.
Draws a random number from the underlying distribution by using generator and parameters
Rng | Must be a random generator |
generator | The random generator to use |
parameters | The parameters to use |
|
nodiscard |
Returns the parameters used to construct the distribution.
void fcppt::random::distribution::basic< Parameters >::param | ( | param_type const & | parameters | ) |
Supplies new parameters to the distribution.
Supplies the new parameters parameters to the distribution.
parameters | The new parameters to use |
void fcppt::random::distribution::basic< Parameters >::reset | ( | ) |
Resets the underlying distribution.
|
friend |