From 03d78c7a962f7d8e7d8dd6ca4fa6c6147ec7030c Mon Sep 17 00:00:00 2001 From: Gustav Eek Date: Wed, 25 Jan 2023 20:57:22 +0100 Subject: [PATCH] Src. Refac. Make method name abstract --- src/main.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index 831dd16..5a9531b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -35,9 +35,10 @@ fn normalize(mut arg: Vec) -> Vec { fn delta(n: i32) -> Vec { - let mut prio: Vec = Vec::new(); + const NAME: &str = "Delta"; const MEAN: f64 = 1.0; // unessential thanks to normalization - if DEBUG { eprint!("Delta: ") } + let mut prio: Vec = Vec::new(); + if DEBUG { eprint!("{}: ", NAME) } for i in 1..n + 1 { prio.push(MEAN); if DEBUG { @@ -50,10 +51,11 @@ fn delta(n: i32) -> Vec { } fn exp(n: i32) -> Vec { + const NAME: &str = "Exp"; const RATE: f64 = 1.0; // rate is unessential thanks to normalization - let mut prio: Vec = Vec::new(); let dist = Exp::new(RATE).unwrap(); - if DEBUG { eprint!("Exp: ") } + let mut prio: Vec = Vec::new(); + if DEBUG { eprint!("{}: ", NAME) } for i in 1..n + 1 { let f = i as f64 / (n as f64 + 1.0); let x = dist.inverse_cdf(f); -- 2.39.2