from random import seed,random
for i in range(21):
if i%3==0:
seed(10)
if i%2==0:
random()
else:
random()
with above code, result is
0.5714025946899135
0.4288890546751146
0.5780913011344704
0.5714025946899135
0.4288890546751146
0.5780913011344704
0.5714025946899135
0.4288890546751146
0.5780913011344704
0.5714025946899135
0.4288890546751146
0.5780913011344704
0.5714025946899135
0.4288890546751146
0.5780913011344704
0.5714025946899135
0.4288890546751146
0.5780913011344704
0.5714025946899135
0.4288890546751146
0.5780913011344704
which,
a=0.5714025946899135
b=0.4288890546751146
c=0.5780913011344704
is continuously repeating.
But according to seed(10), i should get only a=0.5714025946899135
with a seed applyed,
and the others should be random.
but why other value (0.4288890546751146
and 0.5780913011344704
) is constant too?
Aucun commentaire:
Enregistrer un commentaire