Chapter 13. Random Number Generators

The theory of probabilities is at bottom nothing but common sense reduced to calculation.

Théorie Analytique des Probabilities PIERRE-SIMONE LAPLACE, TRANSLATED BY ANGELA PAO

Applications often need to generate numbers with varying degrees of unpredictability. For a card game, if players can predict the next card, the odds change. For a Monte Carlo integration,[1] if the selected input values show too strong a pattern, the value of the integral might not be accurate. For generating security keys, if a hacker can predict the generated keys—perhaps with detailed knowledge of the key-generation algorithm— security is compromised. Standard C and C++ offer the pair of functions rand and srand for generating streams ...

Get The C++ Standard Library Extensions A Tutorial and Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.