Skip to main content

rvs_ratio_uniforms

Function rvs_ratio_uniforms 

Source
pub fn rvs_ratio_uniforms<G: UniformGenerator>(
    pdf: impl Fn(f64) -> f64,
    umax: f64,
    vmin: f64,
    vmax: f64,
    c: f64,
    n: usize,
    rng: &mut G,
) -> Result<Vec<f64>, ErrorsJSL>
Expand description

The ratio-of-uniforms method (SciPy’s rvs_ratio_uniforms): if (u, v) is uniform on the region 0 < u ≤ √f(v/u + c), then v/u + c has density proportional to f. Points are drawn from the rectangle [0, umax] × [vmin, vmax] that contains the region and kept if they fall inside it; c shifts the centre (SciPy’s c).