Struct vosealias::AliasTable [] [src]

pub struct AliasTable<T, F> { /* fields omitted */ }

An alias table, which uses floating point probabilities of type F and table entries of type T.

Methods

impl<T, F> AliasTable<T, F> where
    F: PartialOrd + SampleRange
[src]

Pick a random element from the distribution. Samples from the RNG using ind_sample only.

Given an RNG, produce an iterator that picks random element from the distribution by calling pick repeatedly with the given RNG.

Trait Implementations

impl<T, F> Debug for AliasTable<T, F> where
    F: Debug
[src]

Formats the value using the given formatter.

impl<'a, T, F: 'a> FromIterator<(T, F)> for AliasTable<T, F> where
    F: Float + NumCast + One + SampleRange + Sum<F> + Zero
[src]

Construct an alias table from an iterator. Expects a tuple, where the left-hand element is the distribution's value, and the right-hand element is the value's weight in the distribution.

impl<'a, T, F> IntoIterator for &'a AliasTable<T, F> where
    F: Sized + PartialOrd + SampleRange
[src]

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Produces an iterator that picks random element from the distribution by calling calling pick repeatedly with the thread's RNG.