TehGelly 0992fa9c3b
COMMON: Change PRNG Function to Xorshift* (#3341)
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>
2021-09-09 21:46:08 +03:00
..
2021-07-22 07:28:01 +03:00
2021-08-11 12:01:40 +02:00
2021-05-04 11:46:30 +03:00
2020-11-04 19:42:34 +00:00
2020-11-04 19:42:34 +00:00
2021-08-07 10:44:37 +02:00
2020-11-04 19:42:34 +00:00
2021-03-03 11:17:28 +00:00
2020-09-23 23:20:23 +02:00
2021-08-07 10:44:37 +02:00
2021-05-04 11:46:30 +03:00
2021-05-04 11:46:30 +03:00