1 unstable release

0.1.0 Mar 17, 2024

#983 in Algorithms

Download history 102/week @ 2024-03-11 42/week @ 2024-03-18 24/week @ 2024-04-01

168 downloads per month

MIT license

6KB
103 lines

Crates.io Version

This crate implements the Distribution trait for the discrete normal distribution.

Usage

use dnorm::DiscreteNormal;
use rand::distributions::Distribution;

let d = DiscreteNormal::new(0.0, 3.0);
let v = d.sample(&mut rand::thread_rng());
println!("{} is from a discrete N(0, 9) distribution", v)

Acknowledgements

Karney, C. (2016). Sampling Exactly from the Normal Distribution. ACM Transactions on Mathematical Software, 42(1), 1–14.


lib.rs:

Sampling exactly from the normal distribution (CF Karney)

Dependencies

~310KB