Skip to content

Commit

Permalink
Remove rand crate from dependency tree (bevyengine#3992)
Browse files Browse the repository at this point in the history
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`
  • Loading branch information
BGR360 authored and inodentry committed Aug 8, 2022
1 parent 5cb6089 commit 0b03a22
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion crates/bevy_asset/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_asset/src/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down

0 comments on commit 0b03a22

Please sign in to comment.