NEST  2.6.0,not_revisioned_source_dir@0
Classes | Public Member Functions | Private Attributes | List of all members
nest::Vose Class Reference

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< BiasedCoindist_
 

Detailed Description

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/

Constructor & Destructor Documentation

nest::Vose::Vose ( std::vector< double_t dist)

Constructor taking a probability distribution.

Parameters
dist- probability distribution.

References assert(), dist_, and nest::names::n.

Member Function Documentation

index nest::Vose::get_random_id ( librandom::RngPtr  rng) const
Returns
a randomly selected index with the given distribution

References dist_.

Referenced by nest::ConnectionCreator::convergent_connect_(), and nest::ConnectionCreator::divergent_connect_().

Member Data Documentation

std::vector<BiasedCoin> nest::Vose::dist_
private

Referenced by get_random_id(), and Vose().


The documentation for this class was generated from the following files: