Skip to content

Commit 847f47d

Browse files
committed
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`
1 parent dc3b4b6 commit 847f47d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

crates/bevy_asset/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ crossbeam-channel = "0.5.0"
2929
anyhow = "1.0.4"
3030
thiserror = "1.0"
3131
downcast-rs = "1.2.0"
32+
fastrand = "1.7.0"
3233
notify = { version = "=5.0.0-pre.11", optional = true }
3334
parking_lot = "0.11.0"
34-
rand = "0.8.0"
3535

3636
[target.'cfg(target_arch = "wasm32")'.dependencies]
3737
wasm-bindgen = { version = "0.2" }

crates/bevy_asset/src/handle.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl HandleId {
5555
/// Creates a random id for an asset of type `T`.
5656
#[inline]
5757
pub fn random<T: Asset>() -> Self {
58-
HandleId::Id(T::TYPE_UUID, rand::random())
58+
HandleId::Id(T::TYPE_UUID, fastrand::u64(..))
5959
}
6060

6161
/// Creates the default id for an asset of type `T`.

0 commit comments

Comments
 (0)