pub struct Sampler { /* private fields */ }
Expand description
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::Distribution;
println!("{}", sampler.sample(&mut rng));
Implementations§
Trait Implementations§
Source§impl Distribution<usize> for Sampler
impl Distribution<usize> for Sampler
Auto Trait Implementations§
impl Freeze for Sampler
impl RefUnwindSafe for Sampler
impl Send for Sampler
impl Sync for Sampler
impl Unpin for Sampler
impl UnwindSafe for Sampler
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more