Commit 4c4fcf5d authored by Martin Reinecke's avatar Martin Reinecke
Browse files
parent 2e470ca7
Pipeline #76365 passed with stages
in 23 minutes and 28 seconds
......@@ -85,6 +85,13 @@ _sseq = [np.random.SeedSequence(42)]
_rng = [np.random.default_rng(_sseq[-1])]
# fix for numpy issue #16539
def _fix_seed(seed):
if isinstance(seed, int):
return (seed, 0, 0, 0)
raise TypeError("random seed shold have integer type")
def getState():
"""Returns the full internal state of the module. Intended for pickling.
......@@ -196,7 +203,7 @@ def push_sseq_from_seed(seed):
In all other situations, it is highly recommended to use the
:class:`Context` class for managing the RNG state.
......@@ -276,7 +283,7 @@ class Context(object):
def __init__(self, inp):
if not isinstance(inp, np.random.SeedSequence):
inp = np.random.SeedSequence(inp)
inp = np.random.SeedSequence(_fix_seed(inp))
self._sseq = inp
def __enter__(self):
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment