Chapter 19. C++11 Randomization Library

The goal of most software is to make things more predictable and reduce risk; life is risky enough as it is. But some computer programs need to introduce randomization rather than eliminate it. Such programs include games and computer simulations.

For many years, programmers have used the C-library rand function to get a random number. This function still works in C++, and I have used it in previous chapters.

But randomization is a subtle and tricky subject. The new C++11 specification provides more reliable, more versatile, and less-biased random-number generation. To explain why the C++11 specification is superior in this area, I first need to discuss general issues in randomization.

19.1. Issues in ...

Get C++ for the Impatient now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.