Skip to content

Commit

Permalink
Fix determinism helper
Browse files Browse the repository at this point in the history
  • Loading branch information
Zac-HD committed Nov 16, 2021
1 parent 922973b commit c6dc4af
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions hypothesis-python/src/hypothesis/internal/entropy.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import random
import sys

import hypothesis.core
from hypothesis.errors import InvalidArgument

RANDOMS_TO_MANAGE: list = [random]
Expand Down Expand Up @@ -95,6 +96,10 @@ def deterministic_PRNG(seed=0):
bad idea in principle, and breaks all kinds of independence assumptions
in practice.
"""
if hypothesis.core._hypothesis_global_random is None: # pragma: no cover
hypothesis.core._hypothesis_global_random = random.Random()
register_random(hypothesis.core._hypothesis_global_random)

seed_all, restore_all = get_seeder_and_restorer(seed)
seed_all()
try:
Expand Down

0 comments on commit c6dc4af

Please sign in to comment.