summaryrefslogtreecommitdiffstats
path: root/src/gates.rs
diff options
context:
space:
mode:
authorRose Hogenson <rosehogenson@posteo.net>2023-07-21 21:41:37 -0700
committerRose Hogenson <rosehogenson@posteo.net>2023-07-21 21:41:37 -0700
commitb5caf80b8f18fcafca3ff697f219070825620695 (patch)
treeabd313556c855a109db531d04d5dc4bdf6071fba /src/gates.rs
parent8b51759dc9b26eb9d9e9f94807d7e85a41fbf555 (diff)
downloadstallman-shooter-b5caf80b8f18fcafca3ff697f219070825620695.tar.zst
Remove dependency on the rand crate.
I don't need a dependency to generate random numbers. I know how to generate random numbers.
Diffstat (limited to 'src/gates.rs')
-rw-r--r--src/gates.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/gates.rs b/src/gates.rs
index ebc2b69..1e3630f 100644
--- a/src/gates.rs
+++ b/src/gates.rs
@@ -1,4 +1,5 @@
use super::constants;
+use super::rand;
use super::state;
pub struct Gates {
@@ -57,8 +58,8 @@ impl state::Positioned for Gates {
fn random_position() -> (f64, f64) {
(
- rand::random::<f64>() * (constants::X_DIM - 200) as f64 + 100.,
- rand::random::<f64>() * 100.,
+ rand::random() * (constants::X_DIM - 200) as f64 + 100.,
+ rand::random() * 100.,
)
}
@@ -85,8 +86,7 @@ impl state::StraightBullet for GatesBullet {
fn random_bullet<T: state::Enemy<GatesBullet>>(enemy: &T) -> GatesBullet {
let multiplier = 2. + 3. * (1. - enemy.health());
- let theta: f64 =
- rand::random::<f64>() * 2. * std::f64::consts::PI / 3. + std::f64::consts::PI / 6.;
+ let theta: f64 = rand::random() * 2. * std::f64::consts::PI / 3. + std::f64::consts::PI / 6.;
let dx = f64::cos(theta) * multiplier;
let dy = f64::sin(theta) * multiplier;
GatesBullet::new(enemy.x(), dx, enemy.y(), dy)