File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change 1
1
2
2
from micall .utils .stable_random_distribution import stable_random_distribution
3
3
import numpy as np
4
+ from itertools import islice
4
5
5
6
6
7
def test_indices_in_range ():
@@ -15,6 +16,17 @@ def test_indices_in_range():
15
16
assert 0 <= idx < maximum , f"Index { idx } out of range [0,{ maximum } )"
16
17
17
18
19
+ def test_bounds_are_reachable ():
20
+ """Test that both min and max-1 can be generated."""
21
+
22
+ maximum = 999
23
+ gen = stable_random_distribution (maximum , seed = 123 )
24
+ lst = islice (gen , 1000 )
25
+
26
+ assert 0 in lst
27
+ assert (maximum - 1 ) in lst
28
+
29
+
18
30
def test_deterministic_output_with_seed ():
19
31
"""
20
32
Test that the generator produces the same sequence when
@@ -65,7 +77,7 @@ def test_fair_distribution_behavior():
65
77
"""
66
78
67
79
maximum = 1_000
68
- num_samples = 10_000
80
+ num_samples = 3_000
69
81
for seed in range (100 ):
70
82
# Gather samples from our generator.
71
83
gen = stable_random_distribution (maximum , seed = seed )
You can’t perform that action at this time.
0 commit comments