pub struct WeightedRandom;Expand description
Weighted random selection. Nodes with higher weight are proportionally more likely.
Implementations§
Trait Implementations§
Source§impl Debug for WeightedRandom
impl Debug for WeightedRandom
Source§impl Default for WeightedRandom
impl Default for WeightedRandom
Source§impl<N: Weighted> Strategy<N> for WeightedRandom
impl<N: Weighted> Strategy<N> for WeightedRandom
Source§fn select(&self, candidates: &[N], ctx: &SelectionContext) -> Option<usize>
fn select(&self, candidates: &[N], ctx: &SelectionContext) -> Option<usize>
Pick the next node. Returns
None when candidates is empty or all
candidates are excluded via SelectionContext::exclude.Auto Trait Implementations§
impl Freeze for WeightedRandom
impl RefUnwindSafe for WeightedRandom
impl Send for WeightedRandom
impl Sync for WeightedRandom
impl Unpin for WeightedRandom
impl UnsafeUnpin for WeightedRandom
impl UnwindSafe for WeightedRandom
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more