Struct random_choice::RandomChoice [] [src]

pub struct RandomChoice;

Methods

impl RandomChoice
[src]

fn random_choice_f64<'a, T>(samples: &'a [T], weights: &[f64], n: usize) -> Vec<&'a T>

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

fn random_choice_in_place_f64<T: Clone>(samples: &mut [T], weights: &[f64])

Chooses n samples by their weights. The greater their weights the more likely they get chosen. The result gets saved directly in the samples argument. @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.

fn random_choice_f32<'a, T>(samples: &'a [T], weights: &[f32], n: usize) -> Vec<&'a T>

fn random_choice_in_place_f32<T: Clone>(samples: &mut [T], weights: &[f32])