From 2d5ab36f67aa91cb355a87cc950763f9a8c9b623 Mon Sep 17 00:00:00 2001 From: alemi Date: Sat, 18 Nov 2023 04:55:35 +0100 Subject: [PATCH] fix: should be a float... --- src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index f1427c0..8215d74 100644 --- a/src/main.rs +++ b/src/main.rs @@ -34,7 +34,7 @@ fn main() { pool.reserve(sum as usize); for (count, line) in lines { for _ in 0..count { - pool.push((line, count / sum)); + pool.push((line, count as f32 / sum as f32)); } } @@ -42,5 +42,5 @@ fn main() { println!("Content-type: application/json"); println!(); - println!("{{\"id\":{},\"mood\":\"{}\",\"chance\":{}}}", index, choice, chance); + println!("{{\"id\":{},\"mood\":\"{}\",\"chance\":{:.3}}}", index, choice, chance); }