Regression tests


In [1]:
import tohu
from tohu import *

In [2]:
print(f"Tohu version: {tohu.__version__}")


Tohu version: v0.5.1+6.g6b319e4.dirty

NumpyRandomGenerator

This is a quick sanity check that resetting a NumpyRandomGenerator really fully resets the state and leads to independent runs.


In [3]:
g = NumpyRandomGenerator(method="normal", loc=3.0, scale=5.0)
g.reset(seed=12345); print_generated_sequence(g, num=4)
g.reset(seed=99999); print_generated_sequence(g, num=4)


Generated sequence: 1.9764617025764353, 5.394716690287741, 0.40280642471630923, 0.22134847826254989
Generated sequence: 6.120470228691696, 9.374815429760194, -5.298018043341111, 5.539749427572133

In [4]:
g1 = NumpyRandomGenerator(method="normal", loc=3.0, scale=5.0)
g2 = NumpyRandomGenerator(method="normal", loc=3.0, scale=5.0)
g1.reset(seed=12345)
g2.reset(seed=99999)
print_generated_sequence(g1, num=4)
print_generated_sequence(g2, num=4)


Generated sequence: 1.9764617025764353, 5.394716690287741, 0.40280642471630923, 0.22134847826254989
Generated sequence: 6.120470228691696, 9.374815429760194, -5.298018043341111, 5.539749427572133

In [ ]: