Sampling poisson distribution

This commit is contained in:
Jedrzej Stuczynski
2019-12-13 11:23:25 +00:00
parent 9114a10880
commit eee87a4d45
3 changed files with 10 additions and 1 deletions
+1
View File
@@ -1 +1,2 @@
pub mod bytes;
pub mod poisson;
+6
View File
@@ -0,0 +1,6 @@
use rand_distr::{Distribution, Exp};
pub fn sample(average_delay: f64) -> f64 {
let exp = Exp::new(1.0 / average_delay).unwrap();
exp.sample(&mut rand::thread_rng())
}