Struct random_wheel::RandomWheel [] [src]

pub struct RandomWheel<T> {
    // some fields omitted
}

Methods

impl<T> RandomWheel<T>
[src]

fn new() -> RandomWheel<T>

create a new empty random-wheel

fn len(&self) -> usize

Returns the number of elements in the wheel.

fn push(&mut self, proba: f32, data: T)

add an element associated with a probability

fn sum_proba(&self) -> f32

return total of luck you add with push

fn peek(&self) -> Option<&T>

return a ref to the randomly peeked element

fn pop(&mut self) -> Option<T>

Removes a randomly peeked element and return it