Fix gen_range calls in chars to adapt to rand API change

This commit is contained in:
Juergen Stuber 2024-01-14 20:20:59 +01:00
parent 7cc48f17f2
commit c885427791

View File

@ -70,24 +70,24 @@ fn main() -> std::io::Result<()> {
.collect::<Vec<_>>();
for x in 0..(x_size / 8) {
for y in 0..(y_size / 8) {
let fg = colors[rng.gen_range(0, colors.len())]
let fg = colors[rng.gen_range(0..colors.len())]
.interpolate(Color::black(), 0.8 * rng.gen::<f64>());
let bg = colors[rng.gen_range(0, colors.len())]
let bg = colors[rng.gen_range(0..colors.len())]
.interpolate(Color::black(), 0.8 * rng.gen::<f64>());
let start_index = rng.gen_range(0, buffer.len() / 8) * 8;
let start_index = rng.gen_range(0..buffer.len() / 8) * 8;
let bitmap = &buffer[start_index..(start_index + 8)];
paint_char(&mut frame, x, y, bitmap, fg, bg);
}
}
loop {
if rng.gen::<f64>() < 0.02 {
let x = rng.gen_range(0, x_size / 8);
let y = rng.gen_range(0, y_size / 8);
let fg = colors[rng.gen_range(0, colors.len())]
let x = rng.gen_range(0..x_size / 8);
let y = rng.gen_range(0..y_size / 8);
let fg = colors[rng.gen_range(0..colors.len())]
.interpolate(Color::black(), 0.8 * rng.gen::<f64>());
let bg = colors[rng.gen_range(0, colors.len())]
let bg = colors[rng.gen_range(0..colors.len())]
.interpolate(Color::black(), 0.8 * rng.gen::<f64>());
let start_index = rng.gen_range(0, buffer.len() / 8) * 8;
let start_index = rng.gen_range(0..buffer.len() / 8) * 8;
let bitmap = &buffer[start_index..(start_index + 8)];
paint_char(&mut frame, x, y, bitmap, fg, bg);
}