Random seed

{{Short description|Value used to initialize a pseudo-random number generator}}

{{More citations needed|date=October 2021}}

A random seed (or seed state, or just seed) is a number (or vector) used to initialize a pseudorandom number generator.

A pseudorandom number generator's number sequence is completely determined by the seed: thus, if a pseudorandom number generator is later reinitialized with the same seed, it will produce the same sequence of numbers.

For a seed to be used in a pseudorandom number generator, it does not need to be random. Because of the nature of number generating algorithms, so long as the original seed is ignored, the rest of the values that the algorithm generates will follow probability distribution in a pseudorandom manner.

The choice of a good random seed is crucial in the field of computer security. When a secret encryption key is pseudorandomly generated, having the seed will allow one to obtain the key. High entropy is important for selecting good random seed data.{{Cite news |last=Ward |first=Mark |date=2015-08-09 |title=Web's random numbers are too weak, researchers warn |url=https://www.bbc.com/news/technology-33839925 |url-status=live |archive-url=https://web.archive.org/web/20250323025648/https://www.bbc.com/news/technology-33839925 |archive-date=2025-03-23 |access-date=2025-02-08 |work=BBC News |publisher=BBC |language=en-GB}}

Random seeds need to be chosen carefully in order to ensure random number generation. If a seed is chosen that doesn't provide actual random results, the numbers given by the PRNG (pseudo random number generator) will not work properly in an application that needs them. Charting the output values of a PRNG with a scatter plot is a good way to find out if the seed is working. If the graph shows static, then the PRNG is giving random results, but if a pattern appears, the seed needs to be fixed.{{Cite book |last=Parker |first=Matthew |title=Humble Pi |publisher=Riverhead Books |year=2021 |isbn=9780593084694 |location=London |pages=41–48}}{{Cite web |title=Seeding the Random Number Generator |url=https://help.perforce.com/sourcepro/current/HTML/index.html#page/SourcePro_Net/securityug-UsingSecureSockets.33.15.html |url-status=live |archive-url=https://web.archive.org/web/20250323025110/https://help.perforce.com/sourcepro/current/HTML/index.html#page/SourcePro_Net/securityug-UsingSecureSockets.33.15.html |archive-date=2025-03-23 |access-date=2025-02-08 |website=help.perforce.com |language=en}}

If the same random seed is deliberately shared, it becomes a secret key, so two or more systems using matching pseudorandom number algorithms and matching seeds can generate matching sequences of non-repeating numbers which can be used to synchronize remote systems, such as GPS satellites and receivers.{{r|"sourcepro"}}

Random seeds are often generated from the state of the computer system (such as the time), a cryptographically secure pseudorandom number generator or from a hardware random number generator.

See also

References

{{Reflist}}

Random seed

{{Comp-sci-theory-stub}}