Browse Source

Set some pixels to black in colored noise.

master
Juergen Stuber 2 years ago
parent
commit
eb7ac1c1f1
1 changed files with 7 additions and 1 deletions
  1. +7
    -1
      src/bin/cnoise/main.rs

+ 7
- 1
src/bin/cnoise/main.rs View File

@ -43,7 +43,13 @@ fn main() -> std::io::Result<()> {
loop {
let x = rng.gen_range(0, x_size);
let y = rng.gen_range(0, y_size);
let c = c0.interpolate(c1, rng.gen::<f64>().powf(2.0));
let c = {
if rng.gen::<f64>() < 0.5 {
c0.interpolate(c1, rng.gen::<f64>().powf(2.0))
} else {
Color::black()
}
};
frame[y][x] = c;
let mut buf = Vec::with_capacity(x_size * y_size * 3);


Loading…
Cancel
Save