time-to-botec

Benchmark sampling in different programming languages
Log | Files | Refs | README

commit 6986a1ae421943a308741114ad03e109f6594ace
parent 3fa55de18f1e7636e3a175f60de9068efc3c09d4
Author: NunoSempere <nuno.semperelh@protonmail.com>
Date:   Sat,  6 Apr 2024 11:26:51 -0400

get working version

Diffstat:
Mrust/src/main.rs | 6++----
1 file changed, 2 insertions(+), 4 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(rng: Pcg64Mcg) -> f64 { +fn model(mut rng: Pcg64Mcg) -> f64 { let x = 1.0; let normal = Normal::new(2.0, 3.0).unwrap(); let v = normal.sample(&mut rng); @@ -18,9 +18,7 @@ fn main() { let mut rng = Pcg64Mcg::seed_from_u64(1); // mean 2, standard deviation 3 let v = model(rng); - println!("{} is from a N(2, 9) distribution", v); - let z = model(rng); - println!("{} is from a N(2, 9) distribution", z); + println!("{} is from a N(2, 9) distribution", v) }