diff options
author | metamuffin <metamuffin@disroot.org> | 2025-04-13 14:38:00 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-04-13 14:38:00 +0200 |
commit | 821af51985ace4dc0efb7f7c3ff86c7f8730c9ea (patch) | |
tree | a77d38a791b7e2ae94ee93ecef7c6c413956d18a /src/bot | |
parent | 12f974fc95c9c166423c40381d698286cc6dff39 (diff) | |
download | gpn-tron-rust-821af51985ace4dc0efb7f7c3ff86c7f8730c9ea.tar gpn-tron-rust-821af51985ace4dc0efb7f7c3ff86c7f8730c9ea.tar.bz2 gpn-tron-rust-821af51985ace4dc0efb7f7c3ff86c7f8730c9ea.tar.zst |
Diffstat (limited to 'src/bot')
-rw-r--r-- | src/bot/mod.rs | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/bot/mod.rs b/src/bot/mod.rs index 17472d2..3722bf8 100644 --- a/src/bot/mod.rs +++ b/src/bot/mod.rs @@ -1,6 +1,6 @@ use crate::{game::protocol::Direction, State}; use log::debug; -use rand::{seq::IteratorRandom, thread_rng}; +use rand::{rng, seq::IteratorRandom}; use serde::Deserialize; use std::{ops::DerefMut, sync::Arc}; use tokio::spawn; @@ -38,10 +38,7 @@ async fn bot(_config: Config, state: Arc<State>, name: String) { possible.push(d) } } - *dir = *possible - .iter() - .choose(&mut thread_rng()) - .unwrap_or(&Direction::Up); + *dir = *possible.iter().choose(&mut rng()).unwrap_or(&Direction::Up); debug!(name:?, dir:?; ""); } } |