Struct random_choice::RandomChoice [] [src]

pub struct RandomChoice<RNG: Rng> { /* fields omitted */ }

Methods

impl<RNG: Rng> RandomChoice<RNG>
[src]

Creates a new RandomChoice struct. @param rng the random number generator to use with this stuct.

Chooses n samples by their weights. The greater their weights the more likely they get chosen.

@invariant sum of weights must not overflow. @param samples The to be selected samples @param weights Weights that get chosen by their weight/probability. One weight can be greater 1. @param n Number of randomly chosen samples by weight. @return randomly selected samples by their weights