pub struct Gamma { /* private fields */ }Expand description
Gamma Distribution
§Example
let mut gamma = rand_simple::Gamma::new([1192u32, 765u32, 1543u32]);
assert_eq!(format!("{gamma}"), "Γ(Shape parameter, Scale parameter) = Γ(1, 1)");
println!("Generating a random number following the standard gamma distribution with shape parameter α = 1 and scale parameter β = 1 -> {}", gamma.sample());
// Changing the parameters of the random variable
let shape: f64 = 2f64;
let scale: f64 = 1.5f64;
let result: Result<(f64, f64), &str> = gamma.try_set_params(shape, scale);
assert_eq!(format!("{gamma}"), "Γ(Shape parameter, Scale parameter) = Γ(2, 1.5)");
println!("Generating a random number following the gamma distribution with shape parameter α = {}, and scale parameter β = {} -> {}", shape, scale, gamma.sample());Implementations§
Source§impl Gamma
impl Gamma
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Gamma
impl RefUnwindSafe for Gamma
impl Send for Gamma
impl Sync for Gamma
impl Unpin for Gamma
impl UnwindSafe for Gamma
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