ug_srand->ug_rand_init (improved seeding)

On POSIX systems, add also clock() to the seed + use as a source also
/dev/random if available.
This commit is contained in:
Martin Pulec
2023-08-07 09:14:27 +02:00
parent a097fe7b09
commit f590145ed3
3 changed files with 33 additions and 10 deletions

View File

@@ -419,8 +419,7 @@ struct init_data *common_preinit(int argc, char *argv[])
open_all("ultragrid_*.so", init.opened_libs); // load modules
}
// init_rng in rtp.c added also hostname to the seed
ug_srand((getpid() * 42) ^ get_time_in_ns());
ug_rand_init();
#ifdef __linux__
mtrace();