Statistics Definitions > Random Seed
What is a Random Seed?A random seed specifies the start point when a computer generates a random number sequence. This can be any number, but it usually comes from seconds on a computer system’s clock (Henkemans & Lee, 2001).
A computer counts seconds from January 1, 1970 — a system called Unix time. At time I am writing this sentence it is 11:01:46 EST on February 5, 2017: 1486310506 seconds after 1-1-1970 (you can find the current Unix time here). Having such a large range for seeds (0 to 1+ billion) pretty much ensures that you don’t get the same random seed isn’t used twice — unless you want to.
For example, let’s say you wanted to generate a random number in Excel (Note: Excel sets a limit of 9999 for the seed). If you enter a number into the Random Seed box during the process, you’ll be able to use the same set of random numbers again. If you typed “77” into the box, and typed “77” the next time you run the random number generator, Excel will display that same set of random numbers. If you type “99”, you’ll get an entirely different set of numbers. But if you revert back to a seed of 77, then you’ll get the same set of random numbers you started with.
Why are Seeds Needed?
Computers don’t generate truly random numbers — they are deterministic, which means that they operate by a set of rules. You can mimic randomness by specifying a set of rules. For example, “take a number x, add 900 +x, then subtract 52.” In order for the process to start, you have to specify a starting number, x (the seed). Let’s take the starting number 77:
- Add 900 + 77 = 977
- Subtract 52 = 925
Following the same algorithm, the second “random” number would be:
- 900 + 925 = 1825
- Subtract 52 = 1773
This simple example follows a pattern, but the algorithms behind computer number generation are much more complicated (based on distributions like the Bernoulli distribution or Poisson distribution), mimicking randomness much better than I can do here. But the process still follows a pattern, which will be repeated the next time you enter 77 or 99, or whatever number you choose into the “random seed” box.
Henkemans, D & Lee, M. (2001). C++ Programming for the Absolute Beginner. Cengage Learning.
If you prefer an online interactive environment to learn R and statistics, this free R Tutorial by Datacamp is a great way to get started. If you're are somewhat comfortable with R and are interested in going deeper into Statistics, try this Statistics with R track.