Fix gen_range calls in chars to adapt to rand API change
This commit is contained in:
parent
7cc48f17f2
commit
c885427791
@ -70,24 +70,24 @@ fn main() -> std::io::Result<()> {
|
|||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
for x in 0..(x_size / 8) {
|
for x in 0..(x_size / 8) {
|
||||||
for y in 0..(y_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>());
|
.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>());
|
.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)];
|
let bitmap = &buffer[start_index..(start_index + 8)];
|
||||||
paint_char(&mut frame, x, y, bitmap, fg, bg);
|
paint_char(&mut frame, x, y, bitmap, fg, bg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
loop {
|
loop {
|
||||||
if rng.gen::<f64>() < 0.02 {
|
if rng.gen::<f64>() < 0.02 {
|
||||||
let x = rng.gen_range(0, x_size / 8);
|
let x = rng.gen_range(0..x_size / 8);
|
||||||
let y = rng.gen_range(0, y_size / 8);
|
let y = rng.gen_range(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>());
|
.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>());
|
.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)];
|
let bitmap = &buffer[start_index..(start_index + 8)];
|
||||||
paint_char(&mut frame, x, y, bitmap, fg, bg);
|
paint_char(&mut frame, x, y, bitmap, fg, bg);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user