From 709ffb313f015d702af700605571c08b21ded9c0 Mon Sep 17 00:00:00 2001 From: Timo Schneider Date: Mon, 3 Jun 2024 09:54:40 +0200 Subject: [PATCH] added file backups --- src/main.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main.rs b/src/main.rs index 9b55477..e4d7012 100644 --- a/src/main.rs +++ b/src/main.rs @@ -27,10 +27,10 @@ fn main() { let bounds: Bounds = Bounds::new(LinearBounds::new(3.1_f64, 3.2_f64), LinearBounds::new(-15_f64, 35_f64)); let func: Function = Function::new(f); - let start: Instant = Instant::now(); - println!("{}\n{}ms", func.approximate(&bounds, 10_000_000, THREAD_CNT), start.elapsed().as_millis()) + //let start: Instant = Instant::now(); + //println!("{}\n{}ms", func.approximate(&bounds, 10_000_000, THREAD_CNT), start.elapsed().as_millis()) - //simulate(&bounds, &func) + simulate(&bounds, &func) } fn simulate(bounds: &Bounds, func: &Function) { @@ -48,12 +48,12 @@ fn simulate(bounds: &Bounds, func: &Function) { println!(); } sample_cnt *= 10; - } - let file: io::Result = File::create("output.json"); - if file.is_err() { - panic!("Error creating output file") - } + let file: io::Result = File::create(format!("output{}.json", sample_cnt.ilog10())); + if file.is_err() { + panic!("Error creating output file") + } - if let Err(_) = file.unwrap().write(result.to_json().to_string().as_bytes()) { panic!("Error writing to file") }; + if let Err(_) = file.unwrap().write(result.to_json().to_string().as_bytes()) { panic!("Error writing to file") }; + } }