Implements the discrete uniform distribution. More...
#include <shark/Rng/DiscreteUniform.h>
Public Member Functions | |
DiscreteUniform (RngType &rng, std::size_t low_=0, std::size_t high_=std::numeric_limits< std::size_t >::max()) | |
C'tor, initializes the interval the random numbers are sampled from and associates the distribution with the supplied RNG. More... | |
Base::result_type | operator() (std::size_t low_, std::size_t high_) |
Reinitializes the distribution for the supplied bounds and samples a new random number. Default values are omitted to distinguish the operator from the default one. More... | |
std::size_t | low () const |
Returns the lower bound of the interval. More... | |
std::size_t | high () const |
Adjusts the upper bound of the interval. More... | |
void | setRange (std::size_t low_, std::size_t high_) |
Adjusts the range of the interval. More... | |
double | p (std::size_t x) const |
Calculates the probability of x. More... | |
Implements the discrete uniform distribution.
Definition at line 48 of file DiscreteUniform.h.
|
inline |
C'tor, initializes the interval the random numbers are sampled from and associates the distribution with the supplied RNG.
[in,out] | rng | The RNG this distribution is associated with. |
[in] | low_ | The lower bound of the interval, defaults to 0. |
[in] | high_ | The upper bound of the interval, defaults to std::numeric_limits<std::size_t>::max(). |
Definition at line 61 of file DiscreteUniform.h.
|
inline |
Adjusts the upper bound of the interval.
Definition at line 90 of file DiscreteUniform.h.
Referenced by shark::DiscreteUniform< RngType >::p().
|
inline |
Returns the lower bound of the interval.
Definition at line 84 of file DiscreteUniform.h.
Referenced by shark::DiscreteUniform< RngType >::p().
|
inline |
Reinitializes the distribution for the supplied bounds and samples a new random number. Default values are omitted to distinguish the operator from the default one.
[in] | low_ | The lower bound of the interval. |
[in] | high_ | The upper bound of the interval. |
Definition at line 77 of file DiscreteUniform.h.
References remora::max(), and remora::min().
|
inline |
Calculates the probability of x.
Definition at line 103 of file DiscreteUniform.h.
References shark::DiscreteUniform< RngType >::high(), and shark::DiscreteUniform< RngType >::low().
|
inline |
Adjusts the range of the interval.
Definition at line 96 of file DiscreteUniform.h.
References remora::max(), and remora::min().