make pridemonth rng seeded

This makes sure the chosen VARIANT for a given day is the same,
regardless of whether or not the bot restarts. A different seed
it chosen each day and each year of pride month, which should
lead to okay results spread wise.
This commit is contained in:
2025-06-04 22:47:40 +02:00
parent 8f50a5533c
commit a538710fa1

View File

@@ -1,6 +1,6 @@
use chrono::{Datelike, Utc};
use chrono_tz::Europe::Warsaw;
use rand::seq::IndexedRandom;
use rand::{SeedableRng, seq::IndexedRandom};
use serenity::all::{Context, GuildId};
use service::run_event_service;
use tracing::info;
@@ -86,7 +86,9 @@ impl Event {
format!("Gractwo{suffix}")
}
E::PrideMonth => {
let mut rng = rand::rng();
let now = Utc::now().with_timezone(&Warsaw);
let seed: u64 = (now.year() as u64) * 1000 + (now.day() as u64);
let mut rng = rand::rngs::SmallRng::seed_from_u64(seed);
const VARIANTS: &[&str] = &[
"Miesiąc Dumy",
"Pride Month",