From daaa0f7f93f4815f4ee6764afb076af31d61779a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 27 Jan 2025 10:01:02 -0500 Subject: [PATCH] Update rand requirement from 0.8.5 to 0.9.0 (#25) Updates the requirements on [rand](https://github.com/rust-random/rand) to permit the latest version. - [Release notes](https://github.com/rust-random/rand/releases) - [Changelog](https://github.com/rust-random/rand/blob/master/CHANGELOG.md) - [Commits](https://github.com/rust-random/rand/compare/0.8.5...0.8.5) --- updated-dependencies: - dependency-name: rand dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> [CHORE] fix rand_chacha dep [CHORE] temporary fix of rand deps before final release of rand_distr 0.5.0 [CHORE] fix doc due to rand update [CHORE] update rand deps to 0.9.0 --- Cargo.toml | 8 ++++---- src/lib.rs | 29 +++++++++++++++++++---------- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 5f59646f..4fc7d2b9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,14 +27,14 @@ opt-level = 3 # Enable a large amount of optimization in the dev profile for dep codegen-units = 1 # Compile the entire crate as one unit. lto = "thin" # Do a second optimization pass over the entire program, including dependencies. [dependencies] +rand = "0.9.0" nalgebra = "0.33.2" -rand = { version = "0.8.5", features = ["rand_chacha"] } -rand_distr = "0.4.3" +rand_distr = "0.5.0" +rand_chacha = "0.9.0" rerun = "0.21.0" thiserror = "2.0.11" serde = { version = "1.0.217", features = ["derive"] } serde_yaml = "0.9.34" env_logger = "0.11.6" -log = "0.4.22" +log = "0.4.25" rayon = "1.10.0" -rand_chacha = "0.3.1" diff --git a/src/lib.rs b/src/lib.rs index d982c56e..fabd1696 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -427,7 +427,7 @@ impl Imu { gyro_noise: Normal::new(0.0, gyro_noise_std)?, accel_bias_drift: Normal::new(0.0, accel_bias_std)?, gyro_bias_drift: Normal::new(0.0, gyro_bias_std)?, - rng: ChaCha8Rng::from_entropy(), + rng: ChaCha8Rng::from_os_rng(), }) } /// Updates the IMU biases over time @@ -2020,7 +2020,7 @@ impl Obstacle { /// obstacles: vec![Obstacle::new(Vector3::new(0.0, 0.0, 0.0), Vector3::new(0.0, 0.0, 0.0), 1.0)], /// obstacles_velocity_bounds: [0.0, 0.0, 0.0], /// obstacles_radius_bounds: [0.0, 0.0], -/// rng: ChaCha8Rng::from_entropy(), +/// rng: ChaCha8Rng::from_os_rng(), /// }; /// ``` pub struct Maze { @@ -2064,7 +2064,7 @@ impl Maze { obstacles: Vec::new(), obstacles_velocity_bounds, obstacles_radius_bounds, - rng: ChaCha8Rng::from_entropy(), + rng: ChaCha8Rng::from_os_rng(), }; maze.generate_obstacles(num_obstacles); maze @@ -2082,18 +2082,27 @@ impl Maze { self.obstacles = (0..num_obstacles) .map(|_| { let position = Vector3::new( - rand::Rng::gen_range(&mut self.rng, self.lower_bounds[0]..self.upper_bounds[0]), - rand::Rng::gen_range(&mut self.rng, self.lower_bounds[1]..self.upper_bounds[1]), - rand::Rng::gen_range(&mut self.rng, self.lower_bounds[2]..self.upper_bounds[2]), + rand::Rng::random_range( + &mut self.rng, + self.lower_bounds[0]..self.upper_bounds[0], + ), + rand::Rng::random_range( + &mut self.rng, + self.lower_bounds[1]..self.upper_bounds[1], + ), + rand::Rng::random_range( + &mut self.rng, + self.lower_bounds[2]..self.upper_bounds[2], + ), ); let v_bounds = self.obstacles_velocity_bounds; let r_bounds = self.obstacles_radius_bounds; let velocity = Vector3::new( - rand::Rng::gen_range(&mut self.rng, -v_bounds[0]..v_bounds[0]), - rand::Rng::gen_range(&mut self.rng, -v_bounds[1]..v_bounds[1]), - rand::Rng::gen_range(&mut self.rng, -v_bounds[2]..v_bounds[2]), + rand::Rng::random_range(&mut self.rng, -v_bounds[0]..v_bounds[0]), + rand::Rng::random_range(&mut self.rng, -v_bounds[1]..v_bounds[1]), + rand::Rng::random_range(&mut self.rng, -v_bounds[2]..v_bounds[2]), ); - let radius = rand::Rng::gen_range(&mut self.rng, r_bounds[0]..r_bounds[1]); + let radius = rand::Rng::random_range(&mut self.rng, r_bounds[0]..r_bounds[1]); Obstacle::new(position, velocity, radius) }) .collect();