The old RNG method had non-standard periods, ranging from some seeds looping on themselves (seed = 1184201285) to some seeds having periods as low as 11 or 48, as listed in https://github.com/scummvm/scummvm/pull/3340. This is a problem even for games that run the RNG once a frame, as the possibilities for random events is greatly reduced should the initial seed be in one of these sets of small periods.
Xorshift* is a standard, fast, non-cryptographic PRNG with academic backing that has period 2^32-1 (all seeds lead to another seed except 0, which is excluded from the initial seeds). Many different flavors are possible, as listed in the paper, but the choice implemented in this pull request uses only a single 32-bit integer as a state, like the old PRNG.
Co-authored-by: Thierry Crozat <criezy@scummvm.org>
Co-authored-by: Filippos Karapetis <bluegr@gmail.com>
Adding @defgroup and @ingroup doxygen tags into all headers
in the common folder that contain doxygen blocks.
This improves the structure, readability, and findability
of information in the resulting output.
This commit targets purely structure and does not deal with
the content of the currently existing doxygen documentation.
This also removes the dependency of engines on the event recorder header
and API, and will make it easier to RandomSources that are not properly
registered.