From: Gustav Eek Date: Wed, 25 Jan 2023 19:57:22 +0000 (+0100) Subject: Src. Refac. Make method name abstract X-Git-Tag: v.0.2~2 X-Git-Url: https://git.g-eek.se/?a=commitdiff_plain;h=03d78c7a962f7d8e7d8dd6ca4fa6c6147ec7030c;p=ranknauto.git Src. Refac. Make method name abstract --- 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);