diff --git a/Rust/src/main.rs b/Rust/src/main.rs
@@ -60,9 +60,12 @@ fn get_countrexpl(max: usize, n_threads: usize) -> Option<(usize, usize)> {
for i in 0..n_threads {
let thread_countr_sd = coutexpl_sender.clone();
- let thread_range = (i..max).step_by(n_threads);
let thread_sums = sums_cache.clone();
+ // By separating the interval [0..max] in subsections with the form [i + 0n, i + 1n, i + 2n, ...] we can ensure that every
+ // value will get tested on a single thread and that all threads will perform roughtly the same number of operations
+ let thread_range = (i..max).step_by(n_threads);
+
let child = thread::spawn(move || thread_countr_sd.send(get_iter_countrexpl(thread_range, thread_sums, max))
.expect(&format!("Thread n°{} was unable to sent a message trought the channel", i)));