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); }