commit b02a4440066d9f4cd15820b68f89ae2334038e96
parent 6986a1ae421943a308741114ad03e109f6594ace
Author: NunoSempere <nuno.semperelh@protonmail.com>
Date: Sat, 6 Apr 2024 13:40:39 -0400
have two layers of mutability
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/rust/src/main.rs b/rust/src/main.rs
@@ -5,7 +5,7 @@ use rand_distr::{Normal, Distribution};
// use rand::thread_rng;
// use rand::prelude::*
-fn model(mut rng: Pcg64Mcg) -> f64 {
+fn model(mut rng: &mut Pcg64Mcg) -> f64 {
let x = 1.0;
let normal = Normal::new(2.0, 3.0).unwrap();
let v = normal.sample(&mut rng);
@@ -17,7 +17,7 @@ fn main() {
let mut rng = Pcg64Mcg::seed_from_u64(1);
// mean 2, standard deviation 3
- let v = model(rng);
+ let v = model(&mut rng);
println!("{} is from a N(2, 9) distribution", v)
}