Skip to content

Commit a34f65a

Browse files
hyanwongmergify[bot]
authored andcommitted
Fix np randint on 32 bit systems and set np randseed
1 parent e1435eb commit a34f65a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tests/tsutil.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,15 @@ def get_example_individuals_ts_with_metadata(
120120
tables.metadata = {f"a_{j}": j for j in range(n)}
121121
tables.populations.clear()
122122
tables.individuals.clear()
123+
rng = np.random.default_rng(123)
123124
for i in range(n):
124125
location = [i, i]
125126
individual_meta = {}
126127
pop_meta = {}
127128
if i % 2 == 0:
128129
# Add unicode metadata to every other individual: 8544+i = Roman numerals
129130
individual_meta = {"unicode id": chr(8544 + i)}
130-
individual_flags = np.random.randint(0, np.iinfo(np.uint32).max)
131+
individual_flags = rng.integers(0, np.iinfo(np.uint32).max, dtype=np.int64)
131132
# Also for populations: chr(127462) + chr(127462+i) give emoji flags
132133
pop_meta = {"utf": chr(127462) + chr(127462 + i)}
133134
tables.populations.add_row(metadata=pop_meta) # One pop for each individual

0 commit comments

Comments
 (0)