pub struct LevyFlight {
pub alpha: f64,
pub scale: f64,
}Expand description
Lévy flight with alpha-stable step lengths.
Fields§
§alpha: f64Stability parameter in (0, 2]. Smaller = heavier tails.
scale: f64Scale parameter controlling typical step size.
Implementations§
Source§impl LevyFlight
impl LevyFlight
pub fn new(alpha: f64, scale: f64) -> Self
Sourcepub fn step_length(&self, rng: &mut Rng) -> f64
pub fn step_length(&self, rng: &mut Rng) -> f64
Generate a single step length (absolute value of stable variate).
Sourcepub fn step_2d(&self, rng: &mut Rng) -> Vec2
pub fn step_2d(&self, rng: &mut Rng) -> Vec2
Generate a 2D step: random direction with Lévy-distributed length.
Sourcepub fn path_2d(&self, rng: &mut Rng, steps: usize) -> Vec<Vec2>
pub fn path_2d(&self, rng: &mut Rng, steps: usize) -> Vec<Vec2>
Generate a 2D path starting at the origin.
Auto Trait Implementations§
impl Freeze for LevyFlight
impl RefUnwindSafe for LevyFlight
impl Send for LevyFlight
impl Sync for LevyFlight
impl Unpin for LevyFlight
impl UnsafeUnpin for LevyFlight
impl UnwindSafe for LevyFlight
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.