[][src]Struct rand::distributions::WeightedChoice

pub struct WeightedChoice<'a, T: 'a> { /* fields omitted */ }
Deprecated since 0.6.0:

use WeightedIndex instead

A distribution that selects from a finite collection of weighted items.

Deprecated: use WeightedIndex instead.

Methods

impl<'a, T: Clone> WeightedChoice<'a, T>
[src]

pub fn new(items: &'a mut [Weighted<T>]) -> WeightedChoice<'a, T>
[src]

Deprecated since 0.6.0:

use WeightedIndex instead

Create a new WeightedChoice.

Panics if:

  • items is empty
  • the total weight is 0
  • the total weight is larger than a u32 can contain.

Trait Implementations

impl<'a, T: Clone> Distribution<T> for WeightedChoice<'a, T>
[src]

Important traits for DistIter<'a, D, R, T>
fn sample_iter<'a, R>(&'a self, rng: &'a mut R) -> DistIter<'a, Self, R, T> where
    Self: Sized,
    R: Rng
[src]

Create an iterator that generates random values of T, using rng as the source of randomness. Read more

impl<'a, T: Debug + 'a> Debug for WeightedChoice<'a, T>
[src]

Auto Trait Implementations

impl<'a, T> Send for WeightedChoice<'a, T> where
    T: Send

impl<'a, T> Sync for WeightedChoice<'a, T> where
    T: Sync

Blanket Implementations

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> FromCast for T
[src]

impl<T, U> Cast for T where
    U: FromCast<T>, 
[src]

impl<T> FromBits for T
[src]

impl<T, U> IntoBits for T where
    U: FromBits<T>, 
[src]