Remove rand crate from dependency tree (#3992)

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.

## Changelog

Removed `rand` from dependencies in `bevy_asset` in favor of existing in-tree `fast-rand`
This commit is contained in:
Ben Reeves 2022-07-14 17:00:01 +00:00
parent dc3b4b6c85
commit 847f47d8d4
2 changed files with 2 additions and 2 deletions

View File

@ -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" }

View File

@ -55,7 +55,7 @@ impl HandleId {
/// Creates a random id for an asset of type `T`.
#[inline]
pub fn random<T: Asset>() -> Self {
HandleId::Id(T::TYPE_UUID, rand::random())
HandleId::Id(T::TYPE_UUID, fastrand::u64(..))
}
/// Creates the default id for an asset of type `T`.