Skip to content

Commit

Permalink
Merge pull request #4 from Icelk/dependabot/cargo/rand-0.9
Browse files Browse the repository at this point in the history
Update rand requirement from 0.8 to 0.9
  • Loading branch information
Icelk authored Jan 28, 2025
2 parents a85c404 + a798577 commit e571d19
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ required-features = ["bin"]

[dependencies]
image = { version = "0.25", default-features = false }
rand = { version = "0.8", features = ["small_rng"] }
rand = { version = "0.9", features = ["small_rng"] }
watch = { version = "0.2", features = ["parking_lot"] }

# bin
Expand Down
9 changes: 5 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,10 @@ pub mod primitives {
}
}
/// enables using `rng.gen` to get a Vec3, with x,y,z between 0 and 1
impl rand::distributions::Distribution<Vec3> for rand::distributions::Standard {
impl rand::distr::Distribution<Vec3> for rand::distr::StandardUniform {
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Vec3 {
Vec3::new(rng.gen(), rng.gen(), rng.gen())
let values: [f64; 3] = rng.random();
Vec3::new(values[0], values[1], values[2])
}
}

Expand Down Expand Up @@ -652,7 +653,7 @@ impl Runtime {
zbuf: ImageBuffer::new(0, 0),
max: 0,

rng: rand::rngs::SmallRng::from_entropy(),
rng: rand::rngs::SmallRng::from_os_rng(),
}
}
/// Creates a new runtime from the dimensions of [`Config`].
Expand Down Expand Up @@ -744,7 +745,7 @@ impl Runtime {
/// `rotation` is around [`View::center_camera`], in radians.
#[allow(clippy::many_single_char_names)]
pub fn render(config: &Config<impl Attractor, impl ColorTransform>, runtime: &mut Runtime) {
let mut initial_point = runtime.rng.gen::<Vec3>() * 0.1;
let mut initial_point = runtime.rng.random::<Vec3>() * 0.1;
// skip first 1000 to get good values in the attractor
for _ in 0..1000 {
initial_point = config.attractor.next_point(initial_point);
Expand Down

0 comments on commit e571d19

Please sign in to comment.