summaryrefslogtreecommitdiff
path: root/numpy/random/dsfmt.pyx
diff options
context:
space:
mode:
authormattip <matti.picus@gmail.com>2019-04-12 10:27:33 +0300
committermattip <matti.picus@gmail.com>2019-05-20 18:45:27 +0300
commit9578dcfbe744854312690ea79063e50d67fc88a2 (patch)
treec81fd1e43aa3a2a5124aae8575dcb427746b8ef9 /numpy/random/dsfmt.pyx
parentc53b2eb729bae1f248a2654dfcfa4a3dd3e2902b (diff)
downloadnumpy-9578dcfbe744854312690ea79063e50d67fc88a2.tar.gz
BUG: __dealloc__ can be called without __init__ in some error modes
skip doctests that require scipy move original mtrand module to _mtrand adjust documentation for namespace change
Diffstat (limited to 'numpy/random/dsfmt.pyx')
-rw-r--r--numpy/random/dsfmt.pyx20
1 files changed, 11 insertions, 9 deletions
diff --git a/numpy/random/dsfmt.pyx b/numpy/random/dsfmt.pyx
index 9a7199e85..709c2c8e8 100644
--- a/numpy/random/dsfmt.pyx
+++ b/numpy/random/dsfmt.pyx
@@ -102,13 +102,13 @@ cdef class DSFMT:
generators should be initialized with the same seed to ensure that the
segments come from the same sequence.
- >>> from numpy.random.randomgen.entropy import random_entropy
- >>> from numpy.random.randomgen import RandomGenerator, DSFMT
+ >>> from numpy.random.entropy import random_entropy
+ >>> from numpy.random import RandomGenerator, DSFMT
>>> seed = random_entropy()
>>> rs = [RandomGenerator(DSFMT(seed)) for _ in range(10)]
- # Advance rs[i] by i jumps
+ # Advance each DSFMT instance by i jumps
>>> for i in range(10):
- ... rs[i].jump()
+ ... rs[i].brng.jump()
**State and Seeding**
@@ -182,10 +182,12 @@ cdef class DSFMT:
self.state)
def __dealloc__(self):
- PyArray_free_aligned(self.rng_state.state)
- PyArray_free_aligned(self.rng_state.buffered_uniforms)
- free(self.rng_state)
- free(self._brng)
+ if self.rng_state:
+ PyArray_free_aligned(self.rng_state.state)
+ PyArray_free_aligned(self.rng_state.buffered_uniforms)
+ free(self.rng_state)
+ if self._brng:
+ free(self._brng)
cdef _reset_state_variables(self):
self.rng_state.buffer_loc = DSFMT_N64
@@ -396,7 +398,7 @@ cdef class DSFMT:
Returns
-------
- gen : numpy.random.randomgen.generator.RandomGenerator
+ gen : numpy.random.RandomGenerator # ignore
Random generator used this instance as the basic RNG
"""
if self._generator is None: