Struct histogram_sampler::Sampler [] [src]

pub struct Sampler { /* fields omitted */ }

Used to sample values according to a histogram distribution.

See crate-level docs for details.

Use like:

let original_data = vec![
    (bin, count),
];
let sampler = Sampler::from_bins(original_data, 10 /* bin width */);

let mut rng = rand::thread_rng();
use rand::distributions::IndependentSample;
println!("{}", sampler.ind_sample(&mut rng));

Methods

impl Sampler
[src]

[src]

Create a new [Sampler] from the given input histogram where the bin width is bin_width.

Trait Implementations

impl Sample<usize> for Sampler
[src]

[src]

Generate a random value of Support, using rng as the source of randomness. Read more

impl IndependentSample<usize> for Sampler
[src]

[src]

Generate a random value.

Auto Trait Implementations

impl Send for Sampler

impl Sync for Sampler