Can someone very simply explain what the purpose and function of the seed(x) function are in Python 3?
I am trying to figure out what the random.seed(0) line is supposed to do in this code. I understand every other line except for that one.
# random module is imported
import random
for i in range(5):
# Any number can be used in place of '0'.
random.seed(0)
# Generated random number will be between 1 to 1000.
print(random.randint(1, 1000))
How familiar are you with pesudo-random number generation? All pesudo-random number generators need some sort of seed value to start the calculation of a pesudo-random number.