Suppose that I have a class TestClass(), that has methods that return random numbers generated by either random, numpy or scipy modules. How could I, without modifying the content of the TestClass() make, lets say two instances of the TestClass(), t1 and t2, that will always generate the same random numbers as each other?
For example, suppose that there is a method sample_from_normal_dist().
I would like to have the following behaviour.
print(t1.sample_from_normal_dist(), t2.sample_from_normal_dist())
print(t1.sample_from_normal_dist(), t2.sample_from_normal_dist())
Output:
0.75 0.75
-0.21 -0.21
And I want this to hold for all methods that have to do with generating random numbers.
Aucun commentaire:
Enregistrer un commentaire