From 3bf8f2b7359f093323b4be94f823f17a46bca3e3 Mon Sep 17 00:00:00 2001 From: Ben Reeves Date: Sat, 19 Feb 2022 18:40:53 -0600 Subject: [PATCH] Remove `rand` as a dependency. This replaces `rand` with `fastrand` as the source of randomness for `HandleId::new()` in `bevy_asset`. This was the only crate with a dependency on `rand`, and now the dependency exists only as a dev-dependency. `fastrand` was already in the dependency tree, thanks to `futures-lite`, `async-executor`, and `tempfile` to name a few. --- crates/bevy_asset/Cargo.toml | 2 +- crates/bevy_asset/src/handle.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/bevy_asset/Cargo.toml b/crates/bevy_asset/Cargo.toml index e5f864e0ee5d3..c58bf38d8a142 100644 --- a/crates/bevy_asset/Cargo.toml +++ b/crates/bevy_asset/Cargo.toml @@ -29,9 +29,9 @@ crossbeam-channel = "0.5.0" anyhow = "1.0.4" thiserror = "1.0" downcast-rs = "1.2.0" +fastrand = "1.7.0" notify = { version = "=5.0.0-pre.11", optional = true } parking_lot = "0.11.0" -rand = "0.8.0" [target.'cfg(target_arch = "wasm32")'.dependencies] wasm-bindgen = { version = "0.2" } diff --git a/crates/bevy_asset/src/handle.rs b/crates/bevy_asset/src/handle.rs index 06fdee6907a37..65e1aaeefe3b6 100644 --- a/crates/bevy_asset/src/handle.rs +++ b/crates/bevy_asset/src/handle.rs @@ -51,7 +51,7 @@ impl<'a> From> for HandleId { impl HandleId { #[inline] pub fn random() -> Self { - HandleId::Id(T::TYPE_UUID, rand::random()) + HandleId::Id(T::TYPE_UUID, fastrand::u64(..)) } #[inline]