mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-18 00:49:19 +02:00
Initialize random seed early in the init sequence
Network client will overwrite the seed if necessary.
This commit is contained in:
@@ -320,6 +320,10 @@ int eu07_application::init(int Argc, char *Argv[])
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!Global.random_seed)
|
||||||
|
Global.random_seed = std::random_device{}();
|
||||||
|
Global.random_engine.seed(Global.random_seed);
|
||||||
|
|
||||||
// configure the OS console according to Globals.ShowSystemConsole.
|
// configure the OS console according to Globals.ShowSystemConsole.
|
||||||
// must run AFTER init_settings (so the ini-loaded value is honoured) and
|
// must run AFTER init_settings (so the ini-loaded value is honoured) and
|
||||||
// BEFORE the first WriteLog below (so colored \033[...] sequences emitted
|
// BEFORE the first WriteLog below (so colored \033[...] sequences emitted
|
||||||
@@ -1456,10 +1460,6 @@ bool eu07_application::init_network()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// we're simulation master
|
// we're simulation master
|
||||||
if (!Global.random_seed)
|
|
||||||
Global.random_seed = std::random_device{}();
|
|
||||||
Global.random_engine.seed(Global.random_seed);
|
|
||||||
|
|
||||||
// TODO: sort out this timezone mess
|
// TODO: sort out this timezone mess
|
||||||
std::time_t utc_now = std::time(nullptr);
|
std::time_t utc_now = std::time(nullptr);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user