Skip to content

Commit

Permalink
Update rand requirement from 0.8.5 to 0.9.0 (#25)
Browse files Browse the repository at this point in the history
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](rust-random/rand@0.8.5...0.8.5)

---
updated-dependencies:
- dependency-name: rand
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
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
  • Loading branch information
dependabot[bot] authored and makeecat committed Jan 27, 2025
1 parent 664745a commit daaa0f7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 14 deletions.
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
29 changes: 19 additions & 10 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand All @@ -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();
Expand Down

0 comments on commit daaa0f7

Please sign in to comment.