Improve randomizer seeding

This commit is contained in:
2026-04-03 15:24:02 -04:00
parent d10f5667a9
commit e3c8ef4ab7

View File

@@ -378,7 +378,13 @@ static void bluetooth_callback(bool connected) {
// set up the app on launch (don't put app logic in here); // set up the app on launch (don't put app logic in here);
static void init() { static void init() {
// seed RNG // seed RNG
srand(time(NULL)); uint16_t seed_ms;
time_t seed_time;
time_ms(&seed_time, &seed_ms);
srand((unsigned int)seed_time ^ seed_ms);
rand();
rand();
rand(); // throw away first few values to alleviate seed correlation
// create main Window element and assign to pointer // create main Window element and assign to pointer
s_main_window = window_create(); s_main_window = window_create();