Random Seed
noun
say it: “RAN-dum SEED” /ˈrændəm ˈsid/
The number a program's random numbers start from; the same seed gives the same sequence of random results every time the program runs.
What is a random seed?
A random seed is the number Python's random numbers start from. Give the same seed and the same "random" results
come out on every run, which is what a test needs; libraries such as scikit-learn take one as random_state.
import random
random.seed(7)
print(random.randint(1, 6), random.randint(1, 6))
random.seed(7)
print(random.randint(1, 6), random.randint(1, 6)) # the same two rolls again
In a sentence
- “The split used a random seed, so everyone's training and test rows matched.”
- “With a random seed of 7, the dice game rolls the same numbers in every test.”
Level: Journeyman · More Python terms at this level
Updated