mirror of
https://github.com/osmarks/random-stuff
synced 2025-09-06 04:17:57 +00:00
fractalart things
This commit is contained in:
@@ -6,7 +6,7 @@ edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
image = { version = "0.23", features = ["png"], default-features = false }
|
||||
nanorand = { version = "0.5", features = ["std", "rdseed", "wyrand", "tls"], default-features = false }
|
||||
nanorand = { version = "0.5", features = ["std", "rdseed", "wyrand"], default-features = false }
|
||||
hsl = "0.1.1"
|
||||
gumdrop = "0.8"
|
||||
smallvec = "1.4.1"
|
@@ -45,7 +45,7 @@ fn mod_channel(rng: &mut WyRand, range: u16, n: u16) -> u16 {
|
||||
let rand: u16 = rng.generate::<u16>() % (range * 2 + 2);
|
||||
let o = ((n as u32) + (rand as u32)).saturating_sub(range as u32);
|
||||
// avoid weird artifacts - just directly using `as` truncates it, i.e. drops the high bytes, which leads to integer-overflow-like issues
|
||||
min(o, 65535) as u16
|
||||
max(min(o, 65535), 1) as u16
|
||||
}
|
||||
|
||||
// randomly adjust all the channels in a color by `range`
|
||||
|
Reference in New Issue
Block a user