diff --git a/Cargo.toml b/Cargo.toml index e4fb3a135..56f227f0c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -53,7 +53,7 @@ features = ["common", "serde"] cgmath = { version = "0.16" } criterion = "0.2" ron = "0.4" -rand = "0.5.5" +rand = "0.6.1" serde_json = "1.0" specs-derive = { path = "specs-derive", version = "0.4.0" } diff --git a/benches/world.rs b/benches/world.rs index 8a6310c38..520b38493 100644 --- a/benches/world.rs +++ b/benches/world.rs @@ -110,8 +110,7 @@ fn delete_later(b: &mut Bencher) { } fn create_after_delete(b: &mut Bencher) { - use rand::seq::sample_indices; - use rand::thread_rng; + use rand::prelude::*; let mut rng = thread_rng(); b.iter_with_setup( @@ -119,7 +118,7 @@ fn create_after_delete(b: &mut Bencher) { let mut w = World::new(); let eids: Vec<_> = (0..1000).map(|_| w.create_entity().build()).collect(); - sample_indices(&mut rng, 1000, 100) + (0..1000).choose_multiple(&mut rng, 100) .into_iter() .map(|i| eids[i]) .for_each(|e| { diff --git a/examples/cluster_bomb.rs b/examples/cluster_bomb.rs index a3bd697a9..bb5716443 100644 --- a/examples/cluster_bomb.rs +++ b/examples/cluster_bomb.rs @@ -2,8 +2,7 @@ extern crate rand; extern crate rayon; extern crate specs; -use rand::Rng; -use rand::distributions::{Distribution, Range}; +use rand::prelude::*; use rayon::iter::ParallelIterator; @@ -56,7 +55,9 @@ impl<'a> System<'a> for ClusterBombSystem { ); fn run(&mut self, (entities, mut bombs, positions, updater): Self::SystemData) { - let durability_range = Range::new(10, 20); + use rand::distributions::{Distribution, Uniform}; + + let durability_range = Uniform::new(10, 20); // Join components in potentially parallel way using rayon. (&entities, &mut bombs, &positions) .par_join()