1 unstable release
0.1.0 | Mar 17, 2024 |
---|
#2196 in Algorithms
6KB
103 lines
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