Function rand::distributions::ziggurat
[−]
[src]
fn ziggurat<R: Rng, P, Z>(rng: &mut R, symmetric: bool, x_tab: ZigTable, f_tab: ZigTable, pdf: P, zero_case: Z) -> f64 where P: FnMut(f64) -> f64, Z: FnMut(&mut R, f64) -> f64
Unstable (
rand
): use rand
from crates.io
Sample a random number using the Ziggurat method (specifically the ZIGNOR variant from Doornik 2005). Most of the arguments are directly from the paper:
rng
: source of randomnesssymmetric
: whether this is a symmetric distribution, or one-sided with P(x < 0) = 0.X
: the $x_i$ abscissae.F
: precomputed values of the PDF at the $x_i$, (i.e. $f(x_i)$)F_DIFF
: precomputed values of $f(x_i) - f(x_{i+1})$pdf
: the probability density functionzero_case
: manual sampling from the tail when we chose the bottom box (i.e. i == 0)