Crates.io | dnorm |
lib.rs | dnorm |
version | 0.1.0 |
source | src |
created_at | 2024-03-17 06:51:05.258688 |
updated_at | 2024-03-17 06:51:05.258688 |
description | Sampling exactly from the normal distribution |
homepage | |
repository | https://github.com/azzaouit/dnorm |
max_upload_size | |
id | 1176264 |
size | 6,706 |
This crate implements the Distribution trait for the discrete normal distribution.
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)
Karney, C. (2016). Sampling Exactly from the Normal Distribution. ACM Transactions on Mathematical Software, 42(1), 1–14.