NEST
2.6.0,not_revisioned_source_dir@0
|
Vose's alias method for selecting a random number using a discrete probability distribution. More...
#include <vose.h>
Classes | |
struct | BiasedCoin |
An object containing two possible outcomes and a probability to choose between the two. More... | |
Public Member Functions | |
Vose (std::vector< double_t > dist) | |
Constructor taking a probability distribution. More... | |
index | get_random_id (librandom::RngPtr rng) const |
Private Attributes | |
std::vector< BiasedCoin > | dist_ |
Vose's alias method for selecting a random number using a discrete probability distribution.
See Michael D. Vose (1991), A linear algorithm for generating random numbers with a given distribution, IEEE trans. softw. eng. 17(9):972. See also http://www.keithschwarz.com/darts-dice-coins/
nest::Vose::Vose | ( | std::vector< double_t > | dist | ) |
Constructor taking a probability distribution.
dist | - probability distribution. |
References assert(), dist_, and nest::names::n.
index nest::Vose::get_random_id | ( | librandom::RngPtr | rng | ) | const |
References dist_.
Referenced by nest::ConnectionCreator::convergent_connect_(), and nest::ConnectionCreator::divergent_connect_().
|
private |
Referenced by get_random_id(), and Vose().