Struct rand::distributions::WeightedChoice
source · [−]pub struct WeightedChoice<'a, T: 'a> { /* private fields */ }
👎 Deprecated since 0.6.0:
use WeightedIndex instead
Expand description
A distribution that selects from a finite collection of weighted items.
Deprecated: use WeightedIndex
instead.
Implementations
sourceimpl<'a, T: Clone> WeightedChoice<'a, T>
impl<'a, T: Clone> WeightedChoice<'a, T>
Trait Implementations
sourceimpl<'a, T: Debug + 'a> Debug for WeightedChoice<'a, T>
impl<'a, T: Debug + 'a> Debug for WeightedChoice<'a, T>
sourceimpl<'a, T: Clone> Distribution<T> for WeightedChoice<'a, T>
impl<'a, T: Clone> Distribution<T> for WeightedChoice<'a, T>
sourcefn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> T
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> T
Generate a random value of T
, using rng
as the source of randomness.
sourcefn sample_iter<'a, R>(&'a self, rng: &'a mut R) -> DistIter<'a, Self, R, T>ⓘNotable traits for DistIter<'a, D, R, T>impl<'a, D, R, T> Iterator for DistIter<'a, D, R, T> where
D: Distribution<T>,
R: Rng + 'a, type Item = T;
where
Self: Sized,
R: Rng,
fn sample_iter<'a, R>(&'a self, rng: &'a mut R) -> DistIter<'a, Self, R, T>ⓘNotable traits for DistIter<'a, D, R, T>impl<'a, D, R, T> Iterator for DistIter<'a, D, R, T> where
D: Distribution<T>,
R: Rng + 'a, type Item = T;
where
Self: Sized,
R: Rng,
D: Distribution<T>,
R: Rng + 'a, type Item = T;
Create an iterator that generates random values of T
, using rng
as
the source of randomness. Read more
Auto Trait Implementations
impl<'a, T> RefUnwindSafe for WeightedChoice<'a, T> where
T: RefUnwindSafe,
impl<'a, T> Send for WeightedChoice<'a, T> where
T: Send,
impl<'a, T> Sync for WeightedChoice<'a, T> where
T: Sync,
impl<'a, T> Unpin for WeightedChoice<'a, T>
impl<'a, T> !UnwindSafe for WeightedChoice<'a, T>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more