mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-22 17:18:39 +00:00
Initialize random with better seed
This commit is contained in:
parent
6caa06eaed
commit
e985b7a0bf
1 changed files with 6 additions and 2 deletions
|
@ -691,8 +691,12 @@ static bool init_common(const Settings &cmd_args, int argc, char *argv[])
|
||||||
init_log_streams(cmd_args);
|
init_log_streams(cmd_args);
|
||||||
|
|
||||||
// Initialize random seed
|
// Initialize random seed
|
||||||
srand(time(0));
|
{
|
||||||
mysrand(time(0));
|
u32 seed = static_cast<u32>(time(nullptr)) << 16;
|
||||||
|
seed |= porting::getTimeUs() & 0xffff;
|
||||||
|
srand(seed);
|
||||||
|
mysrand(seed);
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize HTTP fetcher
|
// Initialize HTTP fetcher
|
||||||
httpfetch_init(g_settings->getS32("curl_parallel_limit"));
|
httpfetch_init(g_settings->getS32("curl_parallel_limit"));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue