16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-17 23:39:18 +02:00

Initialize random seed early in the init sequence

Network client will overwrite the seed if necessary.
This commit is contained in:
Sebastian Krzyszkowiak
2026-07-02 03:06:28 +02:00
parent 80c3feac03
commit c98441d1aa

View File

@@ -320,6 +320,10 @@ int eu07_application::init(int Argc, char *Argv[])
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.
// must run AFTER init_settings (so the ini-loaded value is honoured) and
// BEFORE the first WriteLog below (so colored \033[...] sequences emitted
@@ -1456,10 +1460,6 @@ bool eu07_application::init_network()
else
{
// 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
std::time_t utc_now = std::time(nullptr);