Skip to content

Commit 8b00a0e

Browse files
committed
clippy
1 parent bc31c7c commit 8b00a0e

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/bin/2025_10/main.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,20 +108,24 @@ fn solve2(input: &str) -> usize {
108108
let b_idx = rng.gen_range(0..num_solutions_to_keep);
109109
let c_idx = rng.gen_range(0..num_solutions_to_keep);
110110

111-
for d in 0..dimensions {
111+
for (d, max_val) in min_vals.iter().enumerate() {
112112
let x = solutions[a_idx].0[d] + solutions[b_idx].0[d];
113113
let y = solutions[c_idx].0[d];
114114
if y > x {
115115
solutions[idx].0[d] = 0;
116116
} else {
117-
solutions[idx].0[d] = (x - y).min(min_vals[d]);
117+
solutions[idx].0[d] = (x - y).min(*max_val);
118118
}
119119
}
120120
}
121121

122-
for idx in num_solutions_to_keep + num_solitions_to_replace..num_solutions {
123-
for d in 0..dimensions {
124-
solutions[idx].0[d] = rng.gen_range(0..=min_vals[d])
122+
for sol in solutions
123+
.iter_mut()
124+
.take(num_solutions)
125+
.skip(num_solutions_to_keep + num_solitions_to_replace)
126+
{
127+
for (val, max_val) in sol.0.iter_mut().zip(min_vals.iter()) {
128+
*val = rng.gen_range(0..=*max_val);
125129
}
126130
}
127131
}

0 commit comments

Comments
 (0)