8000 Merge pull request #14498 from mattip/random-namespace · numpy/numpy@33d5f9c · GitHub
[go: up one dir, main page]

Skip to content

Commit 33d5f9c

Browse files
authored
Merge pull request #14498 from mattip/random-namespace
MAINT: remove the entropy c-extension module
2 parents e4de01d + 62e384a commit 33d5f9c

File tree

11 files changed

+12
-333
lines changed

11 files changed

+12
-333
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Remove ``numpy.random.entropy`` without a deprecation
2+
-----------------------------------------------------
3+
4+
``numpy.random.entropy`` was added to the `numpy.random` namespace in 1.17.0.
5+
It was meant to be a private c-extension module, but was exposed as public.
6+
It has been replaced by `numpy.random.SeedSequence` so the module was
7+
completely removed.

doc/source/reference/random/entropy.rst

Lines changed: 0 additions & 6 deletions
This file was deleted.

doc/source/reference/random/index.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,6 @@ What's New or Different
151151
select distributions
152152
* Optional ``out`` argument that allows existing arrays to be filled for
153153
select distributions
154-
* `~entropy.random_entropy` provides access to the system
155-
source of randomness that is used in cryptographic applications (e.g.,
156-
``/dev/urandom`` on Unix).
157154
* All BitGenerators can produce doubles, uint64s and uint32s via CTypes
158155
(`~.PCG64.ctypes`) and CFFI (`~.PCG64.cffi`). This allows the bit generators
159156
to be used in numba.
@@ -203,7 +200,6 @@ Features
203200
new-or-different
204201
Comparing Performance <performance>
205202
extending
206-
Reading System Entropy <entropy>
207203

208204
Original Source
209205
~~~~~~~~~~~~~~~

doc/source/reference/random/new-or-different.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,6 @@ Feature Older Equivalent Notes
4545

4646
And in more detail:
4747

48-
* `~.entropy.random_entropy` provides access to the system
49-
source of randomness that is used in cryptographic applications (e.g.,
50-
``/dev/urandom`` on Unix).
5148
* Simulate from the complex normal distribution
5249
(`~.Generator.complex_normal`)
5350
* The normal, exponential and gamma generators use 256-step Ziggurat

numpy/random/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,6 @@
181181
from . import _pickle
182182
from . import common
183183
from . import bounded_integers
184-
from . import entropy
185184

186185
from .mtrand import *
187186
from .generator import Generator, default_rng

numpy/random/entropy.pyx

Lines changed: 0 additions & 155 deletions
This file was deleted.

numpy/random/mt19937.pyx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ cimport numpy as np
55

66
from .common cimport *
77
from .bit_generator cimport BitGenerator, SeedSequence
8-
from .entropy import random_entropy
98

109
__all__ = ['MT19937']
1110

@@ -156,7 +155,8 @@ cdef class MT19937(BitGenerator):
156155
Random seed initializing the pseudo-random number generator.
157156
Can be an integer in [0, 2**32-1], array of integers in
158157
[0, 2**32-1], a `SeedSequence, or ``None``. If `seed`
159-
is ``None``, then sample entropy for a seed.
158+
is ``None``, then fresh, unpredictable entropy will be pulled from
159+
the OS.
160160
161161
Raises
162162
------
@@ -167,7 +167,8 @@ cdef class MT19937(BitGenerator):
167167
with self.lock:
168168
try:
169169
if seed is None:
170-
val = random_entropy(RK_STATE_LEN)
170+
seed = SeedSequence()
171+
val = seed.generate_state(RK_STATE_LEN)
171172
# MSB is 1; assuring non-zero initial array
172173
self.rng_state.key[0] = 0x80000000UL
173174
for i in range(1, RK_STATE_LEN):

numpy/random/setup.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,6 @@ def generate_libraries(ext, build_dir):
6161
# One can force emulated 128-bit arithmetic if one wants.
6262
#PCG64_DEFS += [('PCG_FORCE_EMULATED_128BIT_MATH', '1')]
6363

64-
config.add_extension('entropy',
65-
sources=['entropy.c', 'src/entropy/entropy.c'] +
66-
[generate_libraries],
67-
libraries=EXTRA_LIBRARIES,
68-
extra_compile_args=EXTRA_COMPILE_ARGS,
69-
extra_link_args=EXTRA_LINK_ARGS,
70-
depends=[join('src', 'splitmix64', 'splitmix.h'),
71-
join('src', 'entropy', 'entropy.h'),
72-
'entropy.pyx',
73-
],
74-
define_macros=defs,
75-
)
7664
for gen in ['mt19937']:
7765
# gen.pyx, src/gen/gen.c, src/gen/gen-jump.c
7866
config.add_extension(gen,

numpy/random/src/entropy/entropy.c

Lines changed: 0 additions & 114 deletions
This file was deleted.

numpy/random/src/entropy/entropy.h

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)
0