This commit is contained in:
jane 2021-12-29 23:00:25 -05:00
parent 6cdc0d7d15
commit 5c4803526a

View file

@ -135,17 +135,19 @@ impl Pattern for Random {
let mut rng = rand::thread_rng();
for x in 0..values.len() {
let mut color = (*values)[x];
let min = self.min;
let max = self.max;
if self.r {
let y: f64 = rng.gen();
color[2] = ((y * (max - min))+min) as u8;
color[2] = ((y * (max - min) as f64) as u8 + min);
}
if self.g {
let y: f64 = rng.gen();
color[1] = ((y * (max - min))+min) as u8;
color[1] = ((y * (max - min) as f64) as u8 + min);
}
if self.b {
let y: f64 = rng.gen();
color[0] = ((y * (max - min))+min) as u8;
color[0] = ((y * (max - min) as f64) as u8 + min);
}
}
}