mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 07:04:33 +00:00
Update rand requirement from 0.7 to 0.8 (#1114)
* Update rand requirement from 0.7 to 0.8 * Update examples' usage of Rng::gen_range
This commit is contained in:
parent
cf0e9f9968
commit
4d5ba7918b
5 changed files with 14 additions and 14 deletions
|
@ -81,7 +81,7 @@ bevy_internal = {path = "crates/bevy_internal", version = "0.4.0", default-featu
|
|||
|
||||
[dev-dependencies]
|
||||
anyhow = "1.0"
|
||||
rand = "0.7.3"
|
||||
rand = "0.8.0"
|
||||
ron = "0.6.2"
|
||||
serde = {version = "1", features = ["derive"]}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ thiserror = "1.0"
|
|||
downcast-rs = "1.2.0"
|
||||
notify = { version = "5.0.0-pre.2", optional = true }
|
||||
parking_lot = "0.11.0"
|
||||
rand = "0.7.3"
|
||||
rand = "0.8.0"
|
||||
|
||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||
wasm-bindgen = { version = "0.2" }
|
||||
|
|
|
@ -21,7 +21,7 @@ bevy_tasks = { path = "../bevy_tasks", version = "0.4.0" }
|
|||
bevy_utils = { path = "../bevy_utils", version = "0.4.0" }
|
||||
bevy_ecs_macros = { path = "macros", version = "0.4.0" }
|
||||
fxhash = "0.2"
|
||||
rand = "0.7.3"
|
||||
rand = "0.8.0"
|
||||
serde = "1.0"
|
||||
thiserror = "1.0"
|
||||
fixedbitset = "0.3.1"
|
||||
|
|
|
@ -66,8 +66,8 @@ fn setup(
|
|||
let mut rnd = rand::thread_rng();
|
||||
|
||||
for name in contribs {
|
||||
let pos = (rnd.gen_range(-400.0, 400.0), rnd.gen_range(0.0, 400.0));
|
||||
let dir = rnd.gen_range(-1.0, 1.0);
|
||||
let pos = (rnd.gen_range(-400.0..400.0), rnd.gen_range(0.0..400.0));
|
||||
let dir = rnd.gen_range(-1.0..1.0);
|
||||
let velocity = Vec3::new(dir * 500.0, 0.0, 0.0);
|
||||
let col = gen_color(&mut rnd);
|
||||
|
||||
|
@ -254,7 +254,7 @@ fn collision_system(
|
|||
if bottom < ground {
|
||||
t.translation.y = ground + SPRITE_SIZE / 2.0;
|
||||
// apply an impulse upwards
|
||||
v.translation.y = rnd.gen_range(700.0, 1000.0);
|
||||
v.translation.y = rnd.gen_range(700.0..1000.0);
|
||||
}
|
||||
if top > ceiling {
|
||||
t.translation.y = ceiling - SPRITE_SIZE / 2.0;
|
||||
|
@ -312,9 +312,9 @@ fn contributors() -> Contributors {
|
|||
/// Because there is no `Mul<Color> for Color` instead `[f32; 3]` is
|
||||
/// used.
|
||||
fn gen_color(rng: &mut impl Rng) -> [f32; 3] {
|
||||
let r = rng.gen_range(0.2, 1.0);
|
||||
let g = rng.gen_range(0.2, 1.0);
|
||||
let b = rng.gen_range(0.2, 1.0);
|
||||
let r = rng.gen_range(0.2..1.0);
|
||||
let g = rng.gen_range(0.2..1.0);
|
||||
let b = rng.gen_range(0.2..1.0);
|
||||
let v = Vec3::new(r, g, b);
|
||||
v.normalize().into()
|
||||
}
|
||||
|
|
|
@ -56,15 +56,15 @@ fn setup(
|
|||
mesh: cube_handle.clone(),
|
||||
material: materials.add(StandardMaterial {
|
||||
albedo: Color::rgb(
|
||||
rng.gen_range(0.0, 1.0),
|
||||
rng.gen_range(0.0, 1.0),
|
||||
rng.gen_range(0.0, 1.0),
|
||||
rng.gen_range(0.0..1.0),
|
||||
rng.gen_range(0.0..1.0),
|
||||
rng.gen_range(0.0..1.0),
|
||||
),
|
||||
..Default::default()
|
||||
}),
|
||||
transform: Transform::from_xyz(
|
||||
rng.gen_range(-50.0, 50.0),
|
||||
rng.gen_range(-50.0, 50.0),
|
||||
rng.gen_range(-50.0..50.0),
|
||||
rng.gen_range(-50.0..50.0),
|
||||
0.0,
|
||||
),
|
||||
..Default::default()
|
||||
|
|
Loading…
Reference in a new issue