* fix: whole-number bounds of Random() give a real number again
ee3af0bf (#99, in 26.05.2) renamed RandomInt to an overload,
Random(int, int). The calls with whole-number bounds that expect a real
number in between took the overload and draw whole numbers since:
- wheel flats given with P0 happen to 1 vehicle in 101 (before: none),
the random part of a flat is a whole number of millimetres;
- the chance of truck hunting is h/101 instead of h/100;
- the wind starts with a whole azimuth, speed and rates of change, and
its direction changes in whole degrees per second;
- the tachometer below 5 km/h jumps to whole numbers.
The whole-number draw is RandomInt again, keeping the shared engine and
the swap of inverted bounds; the loading screen's trivia use it. Those
calls take the real Random() again, as up to 26.05.1.
* RandomInt: the comment says what it draws and why it has a name of its own
The comment put the bug on the overloading. It was in the calls that pass
whole-number bounds and expect a real number; the separate name keeps
them on Random(double, double).
* fix: RandomInt draws from the local engine, as up to 26.05.1 from one of its own
From the review of #416: ee3af0bf moved RandomInt from an engine of its own
(std::mt19937 seeded by std::random_device) to Global.random_engine, the
engine of the run's seed, and only the name was taken back here. Its one
caller draws the trivia of the loading screen, in init_modes, before a
network client gets the seed of the session in server_hello: the server's
engine was then one draw ahead of the client's, and with a fixed
randomseed the trivia was the same on every start. It is drawn from
Global.local_random_engine now, the engine of what one machine shows,
seeded from a true random source in init_modes before the loader is made.
The test of the same seed checks the shared engine with Random() and the
local one with RandomInt(); a new test checks that RandomInt() doesn't move
the engine of the run's seed.
---------
Co-authored-by: maj00r <maj00r@host>