aboutsummaryrefslogtreecommitdiff
path: root/src/sample/uniform.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/sample/uniform.rs')
-rw-r--r--src/sample/uniform.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/sample/uniform.rs b/src/sample/uniform.rs
index 2cd3156..c144f27 100644
--- a/src/sample/uniform.rs
+++ b/src/sample/uniform.rs
@@ -30,4 +30,10 @@ impl Sampler for UniformSampler {
fn get_sample(&mut self) -> Float {
self.d.sample(&mut self.r)
}
+
+ fn clone_and_seed(&mut self) -> Box<dyn Sampler + Send> {
+ let mut n = self.clone();
+ n.r = Pcg32::seed_from_u64(self.r.next_u64());
+ Box::new(n)
+ }
}