Struct stochastic_queue::StochasticQueue
source · pub struct StochasticQueue<T> { /* private fields */ }
Expand description
A queue which pops items at random uniformly. It cannot be iterated or peeked.
Implementations§
source§impl<T> StochasticQueue<T>
impl<T> StochasticQueue<T>
sourcepub fn with_capacity(cap: usize) -> Self
pub fn with_capacity(cap: usize) -> Self
Create a queue with an initial capacity.
sourcepub fn push(&mut self, val: T)
pub fn push(&mut self, val: T)
Adds an item to the queue. When it will be chosen to be popped is nondeterministic.