From c82045ada908545d72354cb8a96596fb9f8e55c4 Mon Sep 17 00:00:00 2001 From: Warren Weckesser Date: Thu, 12 Sep 2019 02:28:48 -0400 Subject: [PATCH 1/2] MAINT: random: Revert gh-14458. --- numpy/random/mtrand.pyx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/numpy/random/mtrand.pyx b/numpy/random/mtrand.pyx index 55069097b234..bd23ab957ddb 100644 --- a/numpy/random/mtrand.pyx +++ b/numpy/random/mtrand.pyx @@ -3493,9 +3493,9 @@ cdef class RandomState: cdef int64_t lngood, lnbad, lnsample # This cast to long is required to ensure that the values are inbounds - ongood = np.PyArray_FROM_OTF(ngood, np.NPY_INT64, np.NPY_ALIGNED) - onbad = np.PyArray_FROM_OTF(nbad, np.NPY_INT64, np.NPY_ALIGNED) - onsample = np.PyArray_FROM_OTF(nsample, np.NPY_INT64, np.NPY_ALIGNED) + ongood = np.PyArray_FROM_OTF(ngood, np.NPY_LONG, np.NPY_ALIGNED) + onbad = np.PyArray_FROM_OTF(nbad, np.NPY_LONG, np.NPY_ALIGNED) + onsample = np.PyArray_FROM_OTF(nsample, np.NPY_LONG, np.NPY_ALIGNED) if np.PyArray_NDIM(ongood) == np.PyArray_NDIM(onbad) == np.PyArray_NDIM(onsample) == 0: From e389beef0ef96ad0f3c968f1796368c06a31df64 Mon Sep 17 00:00:00 2001 From: Warren Weckesser Date: Thu, 12 Sep 2019 02:33:54 -0400 Subject: [PATCH 2/2] BUG: random: Fix the mistaken duplicate line. Fixes gh-14557. --- numpy/random/mtrand.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/numpy/random/mtrand.pyx b/numpy/random/mtrand.pyx index bd23ab957ddb..468703e38e88 100644 --- a/numpy/random/mtrand.pyx +++ b/numpy/random/mtrand.pyx @@ -3517,7 +3517,7 @@ cdef class RandomState: # Convert to int64, if necessary, to use int64 infrastructure ongood = ongood.astype(np.int64) onbad = onbad.astype(np.int64) - onbad = onbad.astype(np.int64) + onsample = onsample.astype(np.int64) out = discrete_broadcast_iii(&legacy_random_hypergeometric,&self._bitgen, size, self.lock, ongood, 'ngood', CONS_NON_NEGATIVE, onbad, 'nbad', CONS_NON_NEGATIVE,