fixes
This commit is contained in:
parent
6cdc0d7d15
commit
5c4803526a
1 changed files with 5 additions and 3 deletions
|
@ -135,17 +135,19 @@ impl Pattern for Random {
|
||||||
let mut rng = rand::thread_rng();
|
let mut rng = rand::thread_rng();
|
||||||
for x in 0..values.len() {
|
for x in 0..values.len() {
|
||||||
let mut color = (*values)[x];
|
let mut color = (*values)[x];
|
||||||
|
let min = self.min;
|
||||||
|
let max = self.max;
|
||||||
if self.r {
|
if self.r {
|
||||||
let y: f64 = rng.gen();
|
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 {
|
if self.g {
|
||||||
let y: f64 = rng.gen();
|
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 {
|
if self.b {
|
||||||
let y: f64 = rng.gen();
|
let y: f64 = rng.gen();
|
||||||
color[0] = ((y * (max - min))+min) as u8;
|
color[0] = ((y * (max - min) as f64) as u8 + min);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue