8000 Merge pull request #14502 from charris/backport-14490 · numpy/numpy@0ee534a · GitHub
[go: up one dir, main page]

Skip to content

Commit 0ee534a

Browse files
authored
Merge pull request #14502 from charris/backport-14490
BUG: random: Revert gh-14458 and refix gh-14557.
2 parents 4bd4d98 + 85d82d4 commit 0ee534a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

numpy/random/mtrand.pyx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ cdef class RandomState:
8383
See Also
8484
--------
8585
Generator
86-
mt19937.MT19937
87-
Bit_Generators
86+
MT19937
87+
:ref:`bit_generator`
8888
8989
"""
9090
cdef public object _bit_generator
@@ -3493,9 +3493,9 @@ cdef class RandomState:
34933493
cdef int64_t lngood, lnbad, lnsample
34943494

34953495
# This cast to long is required to ensure that the values are inbounds
3496-
ongood = <np.ndarray>np.PyArray_FROM_OTF(ngood, np.NPY_INT64, np.NPY_ALIGNED)
3497-
onbad = <np.ndarray>np.PyArray_FROM_OTF(nbad, np.NPY_INT64, np.NPY_ALIGNED)
3498-
onsample = <np.ndarray>np.PyArray_FROM_OTF(nsample, np.NPY_INT64, np.NPY_ALIGNED)
3496+
ongood = <np.ndarray>np.PyArray_FROM_OTF(ngood, np.NPY_LONG, np.NPY_ALIGNED)
3497+
onbad = <np.ndarray>np.PyArray_FROM_OTF(nbad, np.NPY_LONG, np.NPY_ALIGNED)
3498+
onsample = <np.ndarray>np.PyArray_FROM_OTF(nsample, np.NPY_LONG, np.NPY_ALIGNED)
34993499

35003500
if np.PyArray_NDIM(ongood) == np.PyArray_NDIM(onbad) == np.PyArray_NDIM(onsample) == 0:
35013501

@@ -3517,7 +3517,7 @@ cdef class RandomState:
35173517
# Convert to int64, if necessary, to use int64 infrastructure
35183518
ongood = ongood.astype(np.int64)
35193519
onbad = onbad.astype(np.int64)
3520-
onbad = onbad.astype(np.int64)
3520+
onsample = onsample.astype(np.int64)
35213521
out = discrete_broadcast_iii(&legacy_random_hypergeometric,&self._bitgen, size, self.lock,
35223522
ongood, 'ngood', CONS_NON_NEGATIVE,
35233523
onbad, 'nbad', CONS_NON_NEGATIVE,

0 commit comments

Comments
 (0)
0