From 75ca3a28e59715316b351c96c08cf08dac546e91 Mon Sep 17 00:00:00 2001 From: Juergen Stuber Date: Mon, 31 Dec 2018 20:34:58 +0100 Subject: [PATCH] Slow down chars mode. --- src/bin/chars/main.rs | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/bin/chars/main.rs b/src/bin/chars/main.rs index 66be99f..257b69d 100644 --- a/src/bin/chars/main.rs +++ b/src/bin/chars/main.rs @@ -62,20 +62,22 @@ fn main() -> std::io::Result<()> { .take(y_size) .collect::>(); loop { - let x = rng.gen_range(0, x_size / 8); - let y = rng.gen_range(0, y_size / 8); - let color = pick_color(c0, c1, &mut rng); - let start_index = rng.gen_range(0, buffer.len() / 8) * 8; - for i in 0..8 { - let b = buffer[start_index + i]; - for j in 0..8 { - frame[y * 8 + i][x * 8 + j] = { - if b & (1 << j) != 0 { - color - } else { - Color::black() - } - }; + if rng.gen::() < 0.01 { + let x = rng.gen_range(0, x_size / 8); + let y = rng.gen_range(0, y_size / 8); + let color = pick_color(c0, c1, &mut rng); + let start_index = rng.gen_range(0, buffer.len() / 8) * 8; + for i in 0..8 { + let b = buffer[start_index + i]; + for j in 0..8 { + frame[y * 8 + i][x * 8 + j] = { + if b & (1 << j) != 0 { + color + } else { + Color::black() + } + }; + } } }