blue-nebula / base

Main repository of Blue Nebula, a fast-paced shooter with a unique parkour system. It is a fork of Red Eclipse and is free software.
https://blue-nebula.org
16 stars 7 forks source link

Replace random number generation engine #191

Open MoonPadUSer opened 4 years ago

MoonPadUSer commented 4 years ago

It looks like the game is currently using a custom implementation of the Mersenne-Twister algorithm (19937 variant) (got this information from @TheAssassin) so instead we could switch to either the STL equivalent of that algorithm or even to a different algorithm/variant

TheAssassin commented 4 years ago

Even if the implementation is correct (I don't know, haven't checked, don't have any doubts about it), it's redundant to the STL nowadays. The code was likely written before C++11 was a thing. In my opinion, the implementation should be replaced by a drop-in replacement using the STL internally. In the future, the uses could be replaced by using the STL classes directly. That'll make tasks like "I need a random number in some range" easier to read and understand for developers with C++/STL experience.