Skip to content

Commit f66f487

Browse files
committed
test new choice method
1 parent fcd62eb commit f66f487

File tree

2 files changed

+15
-122
lines changed

2 files changed

+15
-122
lines changed

esutil/stat/_stat_util.c

Lines changed: 0 additions & 122 deletions
This file was deleted.

esutil/tests/test_random.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,18 @@ def test_cholesky(seed):
5353
for i in range(3):
5454
for j in range(3):
5555
assert abs(dcov[i, j] - cov[i, j]) < tol, '%d, %d' % (i, j)
56+
57+
58+
def test_random_indices():
59+
seed = 5
60+
rng = np.random.default_rng(seed)
61+
62+
ind = rng.choice(10, size=10, replace=False)
63+
ind2 = eu.random.random_indices(10, 10, seed=seed)
64+
assert np.all(ind == ind2)
65+
66+
rng = np.random.default_rng(seed)
67+
68+
ind = rng.choice(10, size=10, replace=True)
69+
ind2 = eu.random.random_indices(10, 10, seed=seed, unique=False)
70+
assert np.all(ind == ind2)

0 commit comments

Comments
 (0)