Improve randomizer seeding
This commit is contained in:
@@ -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
|
||||||
|
|
||||||
// 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();
|
||||||
|
|||||||
Reference in New Issue
Block a user