Skip to main content

gamma_distribution

Function gamma_distribution 

Source
pub fn gamma_distribution<U>(
    uniform_generator: &mut U,
    alpha: f64,
    beta: f64,
) -> Result<f64, ErrorsJSL>
Expand description

A gamma sample with shape alpha and scale beta (mean αβ, variance αβ²), by the Marsaglia-Tsang method (2000): a squeeze-accelerated rejection from a transformed normal, for α ≥ 1; for α < 1, Gamma(α) = Gamma(α + 1) · U^{1/α}.