Programmers have invented many ways for computers to generate seemingly random numbers; the general name for these algorithms is pseudorandom number generators (PRNGs).

PRNGs suffice for trivial applications, such as generating “random” events for computer games or meaningless subject lines for particularly obtrusive unsolicited bulk mailings. For instance, take the linear congruent (aka power residue) generator, a classic example of such an algorithm. Despite its obscure name, this random number generator performs a sequence of simple operations (multiplication, addition, and modulus every time it generates its “random” output. The generator uses its previous output r*t* to calculate the next output value, *rt+1* (where *t* denotes time):

*rt* + 1 = (*a* × *rt* + *c*) mod *M*

The modulo operator controls the range and prevents overflows, a situation that occurs when the result at some point goes beyond the predefined range of values. If *r0*, *a*, *M*, and *c* – a set of control variables for the generator – are all positive integers, all results of this equation fall in the range of 0 to *M-1*.

The modulo operator controls the range and prevents overflows, a situation that occurs when the result at some point goes beyond the predefined range of values. If *r0*, *a*, *M*, and *c* – a set of control variables for the generator – are all positive integers, all results of this equation fall in the range of 0 to *M-1*.

The modulo operator controls the range and prevents overflows, a situation that occurs when the result at some point goes beyond the predefined range of values. If *r0*, *a*, *M*, and *c* – a set of control variables for the generator – are all positive integers, all results of this equation fall in the range of 0 to *M-1*.