impl RouletteWheel
[src]
fn new() -> RouletteWheel
fn with_capacity(cap: usize) -> RouletteWheel
Creates an empty RouletteWheel with space for at least n elements.
fn reserve(&mut self, additional: usize)
Reserves capacity for at least additional
more elements to be inserted.The collection may reserve more space to avoid frequent reallocations.
fn len(&self) -> usize
fn is_empty(&self) -> bool
Returns true
if empty else return false
.
fn clear(&mut self)
Rust Gambling Pattern
fn push(&mut self, fitness: f32, individual: T)
Add an element associated with a probability.
This function might panic if the fitness is less than zeroor if the total fitness gives a non-finite fitness (Inf
).
unsafe fn unchecked_push(&mut self, fitness: f32, individual: T)
Add an element associated with a probability.This unsafe function doesn't check for total fitness overflownether fitness positivity.
fn total_fitness(&self) -> f32
fn select_iter(&self) -> SelectIter
Returns an iterator over the RouletteWheel.
Trait Implementations
impl Clone for RouletteWheel
[src]
fn clone(&self) -> RouletteWheel
fn clone_from(&mut self, source: &Self)
1.0.0
impl FromIterator<(f32, T)> for RouletteWheel
[src]
fn from_iter(iter: A) -> Self where
A: IntoIterator,
A: IntoIterator,
impl IntoIterator for RouletteWheel
[src]
type Item = (f32, T)
type IntoIter = IntoSelectIter
Which kind of iterator are we turning this into? Cubis 2.