pub trait WeightedChoose<Item>: Send + Sync {
// Required methods
fn choose_one(&mut self) -> Result<Item>;
fn choose_multiple(&mut self, amount: usize) -> Result<Vec<Item>>;
fn len(&self) -> usize;
// Provided method
fn is_empty(&self) -> bool { ... }
}
Expand description
A common trait for weighted balance algorithm.
Required Methods§
Sourcefn choose_one(&mut self) -> Result<Item>
fn choose_one(&mut self) -> Result<Item>
The method will choose one item.