Better initialization of random generator
Use full time precision to initialize random generator. The old code was prone to initialize it to the same values in specific circumstances (boot without RTC, multiple VMs starting at once).
This commit is contained in:
parent
70fab17837
commit
eaf63d314d
1 changed files with 3 additions and 1 deletions
|
@ -2144,7 +2144,9 @@ io_init(void)
|
|||
// XXX init_times();
|
||||
// XXX update_times();
|
||||
boot_time = current_time();
|
||||
srandom((uint) (current_real_time() TO_S));
|
||||
|
||||
u64 now = (u64) current_real_time();
|
||||
srandom((uint) (now ^ (now >> 32)));
|
||||
}
|
||||
|
||||
static int short_loops = 0;
|
||||
|
|
Loading…
Reference in a new issue