This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

1use crate::{Color, Fill}; 2 3impl Fill { 4 pub fn random_solid<R: rand::Rng>( 5 rng: &mut R, 6 except: Option<Color>, 7 ) -> Self { 8 Fill::Solid(match except { 9 Some(color) => Color::random_except(rng, color), 10 None => rng.random(), 11 }) 12 } 13 14 pub fn random_hatches<R: rand::Rng>( 15 rng: &mut R, 16 except: Option<Color>, 17 ) -> Self { 18 let hatch_size = rng.random_range(5..=100) as f32 * 1e-2; 19 Fill::Hatches( 20 match except { 21 Some(color) => Color::random_except(rng, color), 22 None => rng.random(), 23 }, 24 rng.random(), 25 hatch_size, 26 // under a certain hatch size, we can't see the hatching if the ratio is not ½ 27 if hatch_size < 8.0 { 28 0.5 29 } else { 30 rng.random_range(1..=4) as f32 / 4.0 31 }, 32 ) 33 } 34}