Skip to content

Commit dcc919b

Browse files
committed
Update to rand 0.9
1 parent 235d387 commit dcc919b

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ members = ["examples/*"]
2222
[dependencies]
2323
bytes = "1.4"
2424
indexmap = "2"
25-
rand = { version = "0.8.5", features = ["small_rng"] }
26-
rand_distr = "0.4.3"
25+
rand = { version = "0.9", features = ["small_rng"] }
26+
rand_distr = "0.5"
2727
regex = { version = "1", optional = true }
2828
scoped-tls = "1.0.1"
2929
tokio = { version = "1.25.0", features = ["full", "test-util"] }

src/builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ impl Builder {
182182
///
183183
/// This will use default rng with entropy from the device running.
184184
pub fn build<'a>(&self) -> Sim<'a> {
185-
self.build_with_rng(Box::new(rand::rngs::SmallRng::from_entropy()))
185+
self.build_with_rng(Box::new(rand::rngs::SmallRng::from_os_rng()))
186186
}
187187

188188
/// Build a sim with a provided `rng`.

src/sim.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,7 @@ mod test {
783783
})
784784
};
785785

786-
let construct_a_first = sim.world.borrow_mut().rng.gen_bool(0.5);
786+
let construct_a_first = sim.world.borrow_mut().rng.random_bool(0.5);
787787
if construct_a_first {
788788
make_a(&mut sim);
789789
make_b(&mut sim);

src/top.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -507,13 +507,13 @@ impl Link {
507507
fn rand_partition(&self, global: &config::MessageLoss, rand: &mut dyn RngCore) -> bool {
508508
let config = self.config.message_loss.as_ref().unwrap_or(global);
509509
let fail_rate = config.fail_rate;
510-
fail_rate > 0.0 && rand.gen_bool(fail_rate)
510+
fail_rate > 0.0 && rand.random_bool(fail_rate)
511511
}
512512

513513
fn rand_repair(&self, global: &config::MessageLoss, rand: &mut dyn RngCore) -> bool {
514514
let config = self.config.message_loss.as_ref().unwrap_or(global);
515515
let repair_rate = config.repair_rate;
516-
repair_rate > 0.0 && rand.gen_bool(repair_rate)
516+
repair_rate > 0.0 && rand.random_bool(repair_rate)
517517
}
518518

519519
fn delay(&self, global: &config::Latency, rand: &mut dyn RngCore) -> Duration {

0 commit comments

Comments
 (0)