O'Reilly logo

C++ for the Impatient by Brian Overland

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required