Struct rand_simple::Levy
source · pub struct Levy { /* private fields */ }Expand description
Lévy Distribution
Example
// Create a new Lévy distribution with a location parameter (μ) of 0 and a scale parameter (θ) of 1
let mut levy = rand_simple::Levy::new([1192_u32, 765_u32]);
assert_eq!(format!("{levy}"), "Lévy(Location parameter, Scale parameter) = Lévy(0, 1)");
println!("Returns a random number following a standard Levy distribution -> {}", levy.sample());
// Modify the distribution's parameters
let location: f64 = -2_f64;
let scale: f64 = 1.5_f64;
// Update the parameters and generate a random number following the modified Levy distribution
let result: Result<(f64, f64), &str> = levy.try_set_params(location, scale);
assert_eq!(format!("{levy}"), "Lévy(Location parameter, Scale parameter) = Lévy(-2, 1.5)");
println!("Returns a random number following a Levy distribution with location μ = {} and scale θ = {} -> {}", location, scale, levy.sample());Implementations§
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Levy
impl Send for Levy
impl Sync for Levy
impl Unpin for Levy
impl UnwindSafe for Levy
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