Need help in understanding the concept here - I have this code
import random
random.seed(a=57)
def run_round(info):
random.seed(a=57)
d = {}
for i in info:
performance_value = random.normalvariate(info[i][0], info[i][1])
d[i] = performance_value
return d
info = {'abc': (100, 5), 'bcd': (95, 5)}
print(run_round(info))
Now if I run this program 5 times in python3, the output is -
{'bcd': 86.51389158254244, 'abc': 105.76045089520113}
{'abc': 91.51389158254244, 'bcd': 100.76045089520113}
{'abc': 91.51389158254244, 'bcd': 100.76045089520113}
{'bcd': 86.51389158254244, 'abc': 105.76045089520113}
{'bcd': 86.51389158254244, 'abc': 105.76045089520113}
And in python2, the output is -
{'bcd': 86.51389158254244, 'abc': 105.76045089520113}
{'bcd': 86.51389158254244, 'abc': 105.76045089520113}
{'bcd': 86.51389158254244, 'abc': 105.76045089520113}
{'bcd': 86.51389158254244, 'abc': 105.76045089520113}
{'bcd': 86.51389158254244, 'abc': 105.76045089520113}
5 is just for reference, what I mean to say is that why is there a difference in values in python3, if I have given a seed which is same in certain cases.
Edit -
tried with random.seed(a=57, version=1)
and got this result -
{'abc': 91.51389158254244, 'bcd': 100.76045089520113}
{'abc': 91.51389158254244, 'bcd': 100.76045089520113}
{'abc': 91.51389158254244, 'bcd': 100.76045089520113}
{'bcd': 86.51389158254244, 'abc': 105.76045089520113}
{'bcd': 86.51389158254244, 'abc': 105.76045089520113}
I did not understand why there is a difference in results even when my seed remains the same.