#include <random.h>
Discrete distribution with weight given by probability vector.
Public Member Functions | |
discrete_dist () | |
Default discrete distribution. More... | |
discrete_dist (const std::vector< T > &plist) | |
Construct from probability vector. More... | |
discrete_dist (std::initializer_list< T > l) | |
Construct from probability list. More... | |
void | reset_weights (const std::vector< T > &plist) |
Reset the discrete distribution from a new probability list. More... | |
int | operator() () |
Draw a random number from the discrete distribution. More... | |
Private Attributes | |
std::discrete_distribution | distribution |
The distribution object that is being used. More... | |
|
inline |
Default discrete distribution.
Always draws 0.
Definition at line 264 of file random.h.
|
inlineexplicit |
|
inlineexplicit |
|
inline |
Reset the discrete distribution from a new probability list.
plist | Vector with probabilities such that P(i) = vec[i] |
|
inline |
Draw a random number from the discrete distribution.
Definition at line 286 of file random.h.
|
private |