Do random number generators use prime numbers because the gaps between them are random?

75 Views Asked by At

Many random number generators like Linear Congruential Generator and the Marsenne Twister generator use prime numbers.

Is it to capitalize on the fact that the gaps between the primes are thought of to be random?

1

There are 1 best solutions below

0
On

No. It's because when the modulus is composite you can have some weird algebraic phenomena take place.

If $p$ is prime then every linear polynomial $f(x) \equiv ax + b \bmod p$ where $a \not\equiv 0 \bmod p$ is a permutation of the integers mod $p$ as $x$ runs over $0, 1, \ldots, p-1$. For composite $m$, linear polynomials mod $m$ don't take on all values mod $m$ for $a$ in $1, \ldots, m-1$ that have a factor in common with $m$.