Generating Random Numbers
The need to generate random numbers arises very often. Most games programs, programs that simulate the real world, almost always need the ability to generate random numbers. Testing a complex program usually needs random input at some point to validate that the program works under diverse conditions, and it’s often convenient to generate such input programmatically. Of course, random numbers can be used to generate random choices of objects, so you have the ability to create random selections of anything.
Unless noted otherwise, all the STL templates discussed in this chapter are defined in the random header. ...