#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 |
Construct from probability vector.
| plist | Vector with probabilities such that P(i) = vec[i] |
Definition at line 269 of file random.h.
|
inlineexplicit |
Construct from probability list.
| l | Initializer list with probabilities such that P(i) = l[i] |
Definition at line 275 of file random.h.
|
inline |
Reset the discrete distribution from a new probability list.
| plist | Vector with probabilities such that P(i) = vec[i] |
Definition at line 280 of file random.h.
|
inline |
Draw a random number from the discrete distribution.
Definition at line 286 of file random.h.
|
private |