Skip to content

Commit

Permalink
Fix stochastic bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremykubica committed Sep 19, 2024
1 parent 91286c1 commit 26fabbd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/tdastro/util_nodes/test_np_random.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def test_numpy_random_uniform():
assert np.allclose(values, values2)

# We can change the range.
np_node3 = NumpyRandomFunc("uniform", low=10.0, high=20.0)
np_node3 = NumpyRandomFunc("uniform", low=10.0, high=20.0, seed=100)
values = np.array([np_node3.generate() for _ in range(10_000)])
assert len(np.unique(values)) > 10
assert np.all(values <= 20.0)
Expand All @@ -67,7 +67,7 @@ def test_numpy_random_uniform():

def test_numpy_random_uniform_multi():
"""Test that we can many generate numbers at once from a uniform distribution."""
np_node = NumpyRandomFunc("uniform")
np_node = NumpyRandomFunc("uniform", seed=100)
state = np_node.sample_parameters(num_samples=10_000)
samples = np_node.get_param(state, "function_node_result")
assert len(samples) == 10_000
Expand Down

0 comments on commit 26fabbd

Please sign in to comment.