pub fn rejection_sample_2d<F>(
f: F,
x_range: (f64, f64),
y_range: (f64, f64),
n: usize,
rng: &mut impl Rng,
) -> Vec<[f64; 2]>Expand description
2-D rejection sampling.
Draws n uniform samples from [x_range.0, x_range.1) × [y_range.0, y_range.1)
and accepts (x, y) when u < f(x, y) where u ~ U[0, max_f].
f must be non-negative; the function evaluates an internal upper bound
by sampling a small grid.