Protect random reseeding with a lock

This commit is contained in:
Andrea Mazzoleni 2026-05-21 00:07:25 +02:00
parent 54d944c496
commit 4259a16931

View file

@ -86,12 +86,18 @@ static uint64_t random_state = 1;
void random_seed(uint64_t seed)
{
lock_random();
random_state = seed;
unlock_random();
}
void random_reseed(void)
{
random_state = os_tick();
uint64_t seed = os_tick();
lock_random();
random_state = seed;
unlock_random();
}
unsigned char random_u8(void)