Asked 13th Sep, 2019

Can someone explain what is seed in generating a random number?

Please explain mathematically?

Most recent answer

11th Jun, 2020
Anton Vrdoljak
University of Mostar
"Random Seed: Definition" From Elementary Statistics for the rest of us!

All Answers (6)

13th Sep, 2019
Zoran Maksimovic
University of Defence Military Academy
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:
I hope that this helps.
13th Sep, 2019
Ujjal Purkayastha
Indian Institute of Science Education and Research Bhopal
Zoran Maksimovic thank you so much for your answer
14th Sep, 2019
Elham Taghizadeh
Wayne State University
Hello Ujjal,
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.
14th Sep, 2019
Ujjal Purkayastha
Indian Institute of Science Education and Research Bhopal
Elham Taghizadeh thank you very much for your explanation.
9th Jun, 2020
Frank P. Coyle
Southern Methodist University
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.
Can you help by adding an answer?

Similar questions and discussions

Related Publications

In this chapter you will learn the basics of working with numbers in R. This includes understanding how to manage the numeric type (integer vs. double), the different ways of generating non-random and random numbers, how to set seed values for reproducible random number generation, and the different ways to compare and round numeric values.
A good arithmetic random number generator should possess full period, uniformity and independence, etc. To obtain the excellent random number generator, many researchers have found good parameters. Also an initial seed is the important factor in random number generator. But, there is no theoretical guideline for using the initial seeds. Therefore,...
The recent flurry of random number routines and your continued plea for material had led me to dust off my favorite trick uniform random number generator. It requires no seed, produces numbers uniformly distributed between 0 and 1, is acyclic and for all practical purposes, is completely unpredictable and irreproducible.
Got a technical question?
Get high-quality answers from experts.