Random Generators: What is a seed?

Computers can't by themselves generate truly random numbers. It's therefore common to use pseudorandom number generators.

A pseudorandom number generator generates the same number sequence over and over. It’s in fact semantically equivalent to

// Seemingly random, but fixed, list of numbers
numbers ← { 8651, 1932, 18626, 77, 8524 }
while true
    for n in numbers
        print n

In practice numbers obviously has more numbers, and the implementation doesn’t store them explicitly.

The seed is simply the index at which the generator starts reading numbers.

To get truly random numbers, the computer needs some source of entropy. Examples of such sources are keyboard/mouse readings or the system clock.

Comments