mirror of
https://github.com/bevyengine/bevy
synced 2024-11-25 14:10:19 +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]
|
[dev-dependencies]
|
||||||
anyhow = "1.0"
|
anyhow = "1.0"
|
||||||
rand = "0.7.3"
|
rand = "0.8.0"
|
||||||
ron = "0.6.2"
|
ron = "0.6.2"
|
||||||
serde = {version = "1", features = ["derive"]}
|
serde = {version = "1", features = ["derive"]}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ thiserror = "1.0"
|
||||||
downcast-rs = "1.2.0"
|
downcast-rs = "1.2.0"
|
||||||
notify = { version = "5.0.0-pre.2", optional = true }
|
notify = { version = "5.0.0-pre.2", optional = true }
|
||||||
parking_lot = "0.11.0"
|
parking_lot = "0.11.0"
|
||||||
rand = "0.7.3"
|
rand = "0.8.0"
|
||||||
|
|
||||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||||
wasm-bindgen = { version = "0.2" }
|
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_utils = { path = "../bevy_utils", version = "0.4.0" }
|
||||||
bevy_ecs_macros = { path = "macros", version = "0.4.0" }
|
bevy_ecs_macros = { path = "macros", version = "0.4.0" }
|
||||||
fxhash = "0.2"
|
fxhash = "0.2"
|
||||||
rand = "0.7.3"
|
rand = "0.8.0"
|
||||||
serde = "1.0"
|
serde = "1.0"
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
fixedbitset = "0.3.1"
|
fixedbitset = "0.3.1"
|
||||||
|
|
|
@ -66,8 +66,8 @@ fn setup(
|
||||||
let mut rnd = rand::thread_rng();
|
let mut rnd = rand::thread_rng();
|
||||||
|
|
||||||
for name in contribs {
|
for name in contribs {
|
||||||
let pos = (rnd.gen_range(-400.0, 400.0), rnd.gen_range(0.0, 400.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 dir = rnd.gen_range(-1.0..1.0);
|
||||||
let velocity = Vec3::new(dir * 500.0, 0.0, 0.0);
|
let velocity = Vec3::new(dir * 500.0, 0.0, 0.0);
|
||||||
let col = gen_color(&mut rnd);
|
let col = gen_color(&mut rnd);
|
||||||
|
|
||||||
|
@ -254,7 +254,7 @@ fn collision_system(
|
||||||
if bottom < ground {
|
if bottom < ground {
|
||||||
t.translation.y = ground + SPRITE_SIZE / 2.0;
|
t.translation.y = ground + SPRITE_SIZE / 2.0;
|
||||||
// apply an impulse upwards
|
// 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 {
|
if top > ceiling {
|
||||||
t.translation.y = ceiling - SPRITE_SIZE / 2.0;
|
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
|
/// Because there is no `Mul<Color> for Color` instead `[f32; 3]` is
|
||||||
/// used.
|
/// used.
|
||||||
fn gen_color(rng: &mut impl Rng) -> [f32; 3] {
|
fn gen_color(rng: &mut impl Rng) -> [f32; 3] {
|
||||||
let r = 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 g = rng.gen_range(0.2..1.0);
|
||||||
let b = rng.gen_range(0.2, 1.0);
|
let b = rng.gen_range(0.2..1.0);
|
||||||
let v = Vec3::new(r, g, b);
|
let v = Vec3::new(r, g, b);
|
||||||
v.normalize().into()
|
v.normalize().into()
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,15 +56,15 @@ fn setup(
|
||||||
mesh: cube_handle.clone(),
|
mesh: cube_handle.clone(),
|
||||||
material: materials.add(StandardMaterial {
|
material: materials.add(StandardMaterial {
|
||||||
albedo: Color::rgb(
|
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()
|
..Default::default()
|
||||||
}),
|
}),
|
||||||
transform: Transform::from_xyz(
|
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,
|
0.0,
|
||||||
),
|
),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
|
Loading…
Reference in a new issue