Skip to content

Commit

Permalink
Fix np randint on 32 bit systems and set np randseed
Browse files Browse the repository at this point in the history
  • Loading branch information
hyanwong authored and mergify[bot] committed Mar 7, 2022
1 parent e1435eb commit a34f65a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/tsutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,15 @@ def get_example_individuals_ts_with_metadata(
tables.metadata = {f"a_{j}": j for j in range(n)}
tables.populations.clear()
tables.individuals.clear()
rng = np.random.default_rng(123)
for i in range(n):
location = [i, i]
individual_meta = {}
pop_meta = {}
if i % 2 == 0:
# Add unicode metadata to every other individual: 8544+i = Roman numerals
individual_meta = {"unicode id": chr(8544 + i)}
individual_flags = np.random.randint(0, np.iinfo(np.uint32).max)
individual_flags = rng.integers(0, np.iinfo(np.uint32).max, dtype=np.int64)
# Also for populations: chr(127462) + chr(127462+i) give emoji flags
pop_meta = {"utf": chr(127462) + chr(127462 + i)}
tables.populations.add_row(metadata=pop_meta) # One pop for each individual
Expand Down

0 comments on commit a34f65a

Please sign in to comment.