aboutsummaryrefslogtreecommitdiff
path: root/server/bot/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'server/bot/src/lib.rs')
-rw-r--r--server/bot/src/lib.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/server/bot/src/lib.rs b/server/bot/src/lib.rs
index 078314b1..31f2132a 100644
--- a/server/bot/src/lib.rs
+++ b/server/bot/src/lib.rs
@@ -15,7 +15,7 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-#![feature(random)]
+
pub mod algos;
pub mod pathfinding;
pub mod step;
@@ -24,7 +24,8 @@ use hurrycurry_game_core::Game;
use hurrycurry_protocol::PacketS;
#[cfg(feature = "debug_events")]
use hurrycurry_protocol::{PlayerID, glam::Vec3};
-use std::{collections::VecDeque, random::random};
+use rand::{Rng, RngExt};
+use std::{collections::VecDeque};
pub struct PacketSink<'a> {
buf: &'a mut VecDeque<PacketS>,
@@ -54,8 +55,8 @@ impl<T: BotAlgo + ?Sized> BotAlgo for Box<T> {
}
}
-fn random_float() -> f32 {
- random::<u32>(..) as f32 / u32::MAX as f32
+fn random_usize<T: Rng>(rng: &mut T) -> usize {
+ usize::from_ne_bytes(rng.random())
}
#[cfg(feature = "debug_events")]