I have a very large simulation in python with lots of modules. I call a lot of random functions. To keep the same random results I have a variable keep_seed_random.
As so:
import random
keep_seed_random = True
if keep_seed_random is False:
fixed_seed = random.Random(0)
else:
fixed_seed = random
Then I use fixed_seed all over the program, such as
fixed_seed.choice(['male', 'female'])
fixed_seed.randint()
fixed_seed.gammavariate(3, 3)
fixed_seed.random()
fixed_seed.randrange(20, 40)
and so on...
It used to work well. But now, that the programme is too large, there is something else interfering and the results are no longer identical, even when I choose keep_seed_random = False
My question is whether there is any other source of randomness in Python that I am missing?
P.S. I import random just once.
Aucun commentaire:
Enregistrer un commentaire