mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 10:03:45 +01:00
Initialize random with better seed
This commit is contained in:
parent
6caa06eaed
commit
e985b7a0bf
@ -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…
Reference in New Issue
Block a user