Stony Brook Algorithm Repository

Random Number Generation


Input Description: Nothing, or perhaps a seed.
Problem: Generate a sequence of random integers.

Excerpt from The Algorithm Design Manual: Random number generation forms the foundation behind such standard algorithmic techniques as simulated annealing and Monte Carlo integration. Discrete event simulations, used to model everything from transportation systems to casino poker, all run on streams of random numbers. Initial passwords and cryptographic keys are typically generated randomly. New developments in randomized algorithms for graph and geometric problems are revolutionizing these fields and establishing randomization as one of the fundamental ideas of computer science.

There can be serious consequences to using a bad random number generator. For example, the security of an Internet password scheme was recently invalidated with the discovery that its keys were produced using a random number generator of such small period that brute-force search quickly exhausted all possible passwords. The accuracy of simulations is regularly compromised or invalidated by poor random number generation. Bottom line: This is an area where people shouldn't mess around, but they do.


libtomcrypt (rating 8)
seedrandom (rating 8)
Random Number Generation using Shift Register and Quasi method (rating 8)
NIST statistical test suite (rating 8)
Parallel Random Number Generation (rating 8)
SPRNG (rating 8)
Pseudo random number generators (rating 5)
Netlib (rating 0)

Recommended Books

Automatic Nonuniform Random Variate Generation by W. H Random Number Generation and Monte Carlo Methods by J. Gentle Algorithms in Java, Third Edition (Parts 1-4) by Robert Sedgewick and Michael Schidlowsky
An Introduction to Kolmogorov Complexity and Its Applications by Ming Li and Paul M. B. Vitanyi A million random digits with 100,000 normal deviates by Rand-Corporation

Related Problems

Generating Partitions

Generating Permutations

Generating Subsets

Constrained and Unconstrained Optimization

As an Amazon affiliate, I earn from qualifying purchases if you buy from links on this website.

Go To Main Page