Seed determines the sequence of pseudorandom numbers that will be generated.
Random function in various programming languages is actually pseudorandom function. The process of generating (pseudo) random numbers has two phases. 1. Setting seed 2. Generating random numbers x1,x2,x3,... Seed is usually an integer For a given seed the sequence x1, x2,x3, ... will ALWAYS be the same. x1,x2,... are usually floating point between 0 and 1. But it could depend on the given random function implementation. Example: For seed 1234 you could get the sequence: 0.342, 0.13, 0.145, 0.1342, 0.555,.... For seed 4321 you could get the sequence 0.1525, 0.738 , 0.2348, .... etc, Internally the random function could be defined as Random(seed, n) where seed is obviously seed, and n is index of xn.The function could be also defined as Random(seed, prev_rand_number). In concrete realization it usually works like this: seed(1234); Random(); Random(); This is written in no particular language, where in first line the seed is set to 1234. The second line generates x1 in this example it would be 0.342. The second line generates x2 and that would be 0.13, ... For more you could look at:
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).
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.
Most (pseudo) random number generators use a simple formula to compute the next 'random' number N2 from the current number N1. They multiply N1 by a big number and then add a big number AND then do a mod m. The result is a number that 'randomly' far away from the original N1. When testing code with random data you want to use the same seed at the start of your code so that you can reproduce errors for debugging. But when you move the code into production, use the system clock or something just coming on the scene - QRNGs - Quantum Random Number Generators.