random.seed(a, version) in python is used to initialize the pseudo-random number generator (PRNG).
PRNG is algorithm that generates sequence of numbers approximating the properties of random numbers. These random numbers can be reproduced using the seed value. So, if you provide seed value, PRNG starts from an arbitrary starting state using a seed.
a is the seed value. If the a value is
None, then by default, current system time is used.
version is An integer specifying how to convert the a parameter into a integer. Default value is 2.
random.randint(1, 10) #this gives output of 1
If you want the same random number to be reproduced then provide the same seed again
random.randint(1, 10) # this will give the same output of 1
If you don’t provide the seed, then it generate different number and not 1 as before
random.randint(1, 10) # this gives 7 without providing seed
If you provide different seed than before, then it will give you a different random number
random.randint(1, 10) # this gives you 5 not 1
So, in summary, if you want the same random number to be reproduced, provide the seed. Specifically, the same seed.