aboutsummaryrefslogtreecommitdiff
path: root/src/bot/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/bot/mod.rs')
-rw-r--r--src/bot/mod.rs7
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:?; "");
}
}