Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update rand requirement from 0.8 to 0.9 #4

Merged
merged 2 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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