Pseudo-random number generators work by performing some operation on a value. Generally this value is the previous number generated by the generator. However, the first time you use the generator, there is no previous value.

Seeding a pseudo-random number generator gives it its first "previous" value. Each seed value will correspond to a sequence of generated values for a given random number generator. That is, if you provide the same seed twice, you get the same sequence of numbers twice.

Generally, you want to seed your random number generator with some value that will change each execution of the program. For instance, the current time is a frequently-used seed. The reason why this doesn't happen automatically is so that if you want, you can provide a specific seed to get a known sequence of numbers.

Answer from Eric Finn on Stack Overflow
🌐
GeeksforGeeks
geeksforgeeks.org › python › random-seed-in-python
Python - random.seed( ) method - GeeksforGeeks
January 14, 2026 - Using a seed ensures that the split remains the same across multiple runs. ... random.shuffle(a) shuffles the list 'a' randomly but because of the seed() method we get the same shuffled list every time.
🌐
W3Schools
w3schools.com › python › ref_random_seed.asp
Python Random seed() Method
Note: If you use the same seed value twice you will get the same random number twice. See example below
Discussions

Explain random.seed() like I’m five.
Back before computers, they used to publish books of random numbers . random.seed() is like opening a book of random numbers to a specific page. The numbers on that page are still random, but if you remember what page you turned to you will always get the same random numbers. In python, this means your code will consistently produce the same results every time. This is useful if, for example, you a writing a tutorial for random.randint() and you want to have text that references the numbers that the function spits out (along with many types of analyses that involve randomness). If you don't care about having consistent results each time you run your code, you don't need to use it. More on reddit.com
🌐 r/learnpython
22
54
January 17, 2022
What does `random.seed()` do in Python? - Stack Overflow
I am a bit confused on what random.seed() does in Python. For example, why does the below trials do what they do (consistently)? More on stackoverflow.com
🌐 stackoverflow.com
March 28, 2019
Generate Random Seed In Python - Stack Overflow
This one, for example, looks pretty similar to the expected output the OP asked for. I guess you meant random ints and strings in the output. I am missing something? ... OP, in case you aren't aware, "seed" usually refers to the input of an RNG. For some RNG implementations, it is possible to extract the seed from an existing RNG. Python... More on stackoverflow.com
🌐 stackoverflow.com
Random Number Seed Generation
Quality of the “seed” for random numbers defines the usefulness of random numbers. If the “seed” is knowable then the output is deterministic. The best “seed” would be a random number as that is indeterminate. If we had that real random number then why would you need a random number ... More on discuss.python.org
🌐 discuss.python.org
14
0
October 18, 2023
🌐
Tutorialspoint
tutorialspoint.com › python › number_seed.htm
Python random.seed() Method
Random number with seed 10 : 0.57140259469 Random number with seed 10 : 0.57140259469 Random number with seed 10 : 0.57140259469 · If we use the same see twice,we will obtain the same set of random numbers twice.
🌐
Reddit
reddit.com › r/learnpython › explain random.seed() like i’m five.
r/learnpython on Reddit: Explain random.seed() like I’m five.
January 17, 2022 -

Hey python wizards. I’m just getting started with python, and I’m unsure what random seed does? I’ve gotten as far as it sorta provides a starting point for the algorithm to ensure a testable result, but how on earth does it compute the values next when doing e.g. random.randint()? Could someone explain it to me like I’m five?

🌐
Medium
medium.com › data-science › random-seeds-and-reproducibility-933da79446e3
Random Seeds and Reproducibility. Setting Up Your Experiments in Python… | by Daniel Godoy | TDS Archive | Medium
May 14, 2022 - Python's own RNG is not the only one you will likely need to set a seed for. If you're using Numpy as well, you'll need to set a seed for its own RNG. You can use np.random.seed()for that: Random numbers in Numpy (legacy). Image by author. You can see from the example above that Numpy's RNG behaves the same way as Python's RNG: once a seed is set, the generator outputs the very same sequence of numbers, 6, 3, 7, and 4.
🌐
PYnative
pynative.com › home › python › random › python random.seed() function to initialize the pseudo-random number generator
Python random.seed() function to initialize the pseudo-random number generator
May 3, 2024 - import random from datetime import datetime # Random number with system time random.seed(datetime.now()) print("Random Number", random.randint(25, 50)) # Output 50Code language: Python (python) Run · Sometimes it is useful to be able to reproduce ...
Find elsewhere
🌐
Python documentation
docs.python.org › 3 › library › random.html
random — Generate pseudo-random numbers
February 23, 2026 - The weights or cum_weights can use any numeric type that interoperates with the float values returned by random() (that includes integers, floats, and fractions but excludes decimals). Weights are assumed to be non-negative and finite. A ValueError is raised if all weights are zero. For a given seed, the choices() function with equal weighting typically produces a different sequence than repeated calls to choice().
🌐
Educative
educative.io › answers › how-to-use-random-seed-method-in-python
How to use random seed() method in Python
Now, let us generate a random number by passing a seed value (5) and a version (3). ... Now, let us see what happens when we use the same seed value twice.
🌐
Codecademy
codecademy.com › docs › python › random module › .seed()
Python | Random Module | .seed() | Codecademy
May 15, 2024 - In most cases, the .seed() method uses the current time of the computer’s system to initialize a new generator: ... In the example below, the .seed() method is used three times, once with no value and the other two with the same value of 5.
🌐
NumPy
numpy.org › doc › stable › reference › random › generated › numpy.random.seed.html
numpy.random.seed — NumPy v2.4 Manual
Reseed the singleton RandomState instance · This is a convenience, legacy function that exists to support older code that uses the singleton RandomState. Best practice is to use a dedicated Generator instance rather than the random variate generation methods exposed directly in the random module
🌐
Scaler
scaler.com › home › topics › python random seed()
Python random seed()- Scaler Topics
April 12, 2024 - The syntax of the random sample Python is very easy. Here, the seedValue is an optional parameter which denotes the seed value for the random number generator.
🌐
Python.org
discuss.python.org › python help
Random Number Seed Generation - Python Help - Discussions on Python.org
October 18, 2023 - Quality of the “seed” for random numbers defines the usefulness of random numbers. If the “seed” is knowable then the output is deterministic. The best “seed” would be a random number as that is indeterminate. If we had …
🌐
Spark By {Examples}
sparkbyexamples.com › home › python › python random seed() function
Python Random seed() Function - Spark By {Examples}
May 31, 2024 - The random seed is a numerical value that repeats pseudo-random numbers in Python. The value in the random seed saves the state of randomness. For example, If we call the seed function with seed value ‘1’ multiple times, the computer generates the same random numbers.
🌐
Quora
quora.com › What-is-the-best-way-to-generate-random-seeds-in-python
What is the best way to generate random seeds in python? - Quora
For example in Python, if you use seed(123) and then generate some random numbers they will be the same with the ones you generate later on but with the same seed (123) as the picture below shows.
Top answer
1 of 8
4
The seed method is used to initialize the pseudorandom number generator in Python.The random module uses the seed value as a base to generate a random number. if seed value is not present it takes system current time. if you provide same seed value before generating random data it will produce the same data. Example:import random random.seed( 30 ) print ("first number - ", random.randint(25,50)) random.seed( 30 ) print ("Second number- ", random.randint(25,50)) Output: first number - 42 Second number - 42
2 of 8
2
Pseudo-random number generators work by performing some operation on a value. Generally this value is the previous number generated by the generator. However, the first time you use the generator, there is no previous value.Seeding a pseudo-random number generator gives it its first "previous" value. Each seed value will correspond to a sequence of generated values for a given random number generator. That is, if you provide the same seed twice, you get the same sequence of numbers twice.Generally, you want to seed your random number generator with some value that will change each execution of the program. For instance, the current time is a frequently-used seed. The reason why this doesn't happen automatically is so that if you want, you can provide a specific seed to get a known sequence of numbers.Hope it works!!If you are a beginner and need to know more about Python, It's recommended to go for Python Certification course today.Thanks!
🌐
Scientific-python
scientific-python.org › specs › spec-0007
Scientific Python - SPEC 7 — Seeding Pseudo-Random Number Generation
Parameters ---------- old_name : str The old name of the PRNG argument (e.g. `seed` or `random_state`). position_num : int, optional The (0-indexed) position of the old PRNG argument (if accepted by position). Maintainers are welcome to eliminate this argument and use, for example, `inspect`, if preferred.
🌐
NumPy
numpy.org › doc › 2.0 › reference › random › generated › numpy.random.seed.html
numpy.random.seed — NumPy v2.0 Manual
Reseed the singleton RandomState instance · This is a convenience, legacy function that exists to support older code that uses the singleton RandomState. Best practice is to use a dedicated Generator instance rather than the random variate generation methods exposed directly in the random module