My newest project is the development of a text based RPG and now I need a random number generator, a good one to compute in different situations whether some action can be performed without problems or not. Everyone of us knows, that the basic functions std::srand and std::rand are simple and easy algorithms to compute pseudo random values. However I want to have real and not pseudo values. Therefore i want to ask, whether it would to much overkill using a better solution than the mentioned one and to stick to the basics; and if not, what would you suggest? How to implement such a “good generator”?
My newest project is the development of a text based RPG and now I
Share
My suggestion is to use Boost.Random. It has a number of quite good (and fast) RNGs. You don’t need a cryptographically secure one, but the ones they offer are better than
rand.I’d go with mt19937 myself. It has a long period and is pretty fast. But Boost.Random has lots of these things, for most of your non-cryptographically secure needs.