@@ -779,6 +779,9 @@ def randoms(
779
779
would occur with very low probability when it is set to True, and this
780
780
flag should only be set to True when your code relies on the distribution
781
781
of values for correctness.
782
+
783
+ For managing global state, see the :func:`~hypothesis.strategies.random_module`
784
+ strategy and :func:`~hypothesis.register_random` function.
782
785
"""
783
786
check_type (bool , note_method_calls , "note_method_calls" )
784
787
check_type (bool , use_true_random , "use_true_random" )
@@ -814,16 +817,16 @@ def do_draw(self, data):
814
817
@cacheable
815
818
@defines_strategy ()
816
819
def random_module () -> SearchStrategy [RandomSeeder ]:
817
- """The Hypothesis engine handles PRNG state for the stdlib and Numpy random
818
- modules internally, always seeding them to zero and restoring the previous
819
- state after the test.
820
+ """Hypothesis always seeds global PRNGs before running a test, and restores the
821
+ previous state afterwards.
820
822
821
823
If having a fixed seed would unacceptably weaken your tests, and you
822
824
cannot use a ``random.Random`` instance provided by
823
825
:func:`~hypothesis.strategies.randoms`, this strategy calls
824
826
:func:`python:random.seed` with an arbitrary integer and passes you
825
827
an opaque object whose repr displays the seed value for debugging.
826
- If ``numpy.random`` is available, that state is also managed.
828
+ If ``numpy.random`` is available, that state is also managed, as is anything
829
+ managed by :func:`hypothesis.register_random`.
827
830
828
831
Examples from these strategy shrink to seeds closer to zero.
829
832
"""
0 commit comments