From 3ef8f4d918406eec6bdc29e0ebd883fabfac9b2e Mon Sep 17 00:00:00 2001 From: Julian T Date: Thu, 5 Aug 2021 15:44:40 +0200 Subject: Add picture for c5505ab84820248c6dba35fc06aef9e0ced183de --- src/sample/uniform.rs | 39 --------------------------------------- 1 file changed, 39 deletions(-) delete mode 100644 src/sample/uniform.rs (limited to 'src/sample/uniform.rs') diff --git a/src/sample/uniform.rs b/src/sample/uniform.rs deleted file mode 100644 index c144f27..0000000 --- a/src/sample/uniform.rs +++ /dev/null @@ -1,39 +0,0 @@ -use crate::Float; -use super::Sampler; - -use rand::prelude::*; -use rand::distributions::Uniform; -use rand_pcg::Pcg32; - -#[derive(Clone)] -pub struct UniformSampler { - r: Pcg32, - d: Uniform, -} - -impl UniformSampler { - pub fn new() -> Self { - Self::default() - } -} - -impl Default for UniformSampler { - fn default() -> Self { - Self { - r: Pcg32::seed_from_u64(1), - d: Uniform::new(0.0, 1.0), - } - } -} - -impl Sampler for UniformSampler { - fn get_sample(&mut self) -> Float { - self.d.sample(&mut self.r) - } - - fn clone_and_seed(&mut self) -> Box { - let mut n = self.clone(); - n.r = Pcg32::seed_from_u64(self.r.next_u64()); - Box::new(n) - } -} -- cgit v1.2.3