diff options
| author | nokoe <nokoe@mailbox.org> | 2026-02-26 05:15:54 +0100 |
|---|---|---|
| committer | nokoe <nokoe@mailbox.org> | 2026-02-27 19:31:14 +0100 |
| commit | a859bceeddc8e746bba630b3cc197532b68adbcb (patch) | |
| tree | f8e033595d21e4de34774e4caed8b483c7eba5c6 /server/bot/src/lib.rs | |
| parent | 6419d8c8139d697af309b7db2e698effa8290582 (diff) | |
| download | hurrycurry-a859bceeddc8e746bba630b3cc197532b68adbcb.tar hurrycurry-a859bceeddc8e746bba630b3cc197532b68adbcb.tar.bz2 hurrycurry-a859bceeddc8e746bba630b3cc197532b68adbcb.tar.zst | |
use stable rust toolchainstable-rust
Diffstat (limited to 'server/bot/src/lib.rs')
| -rw-r--r-- | server/bot/src/lib.rs | 9 |
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")] |