Skip to content

random.randint failure with large int64s on windows #6812

@jreback

Description

@jreback

clearly using platform ints internally. But I think this should upcast in the case of overflow?

In [21]: np.random.randint(np.iinfo(np.int32).min,np.iinfo(np.int32).max,10)
Out[21]:
array([ -397752718, -1983241147,  -920985850, -2131569981,  -769723972,
        -499680303,  1808795318,  -636996393, -1437760815,  1771191619])

In [22]: np.random.randint(np.iinfo(np.int64).min,np.iinfo(np.int64).max,10)
---------------------------------------------------------------------------
OverflowError                             Traceback (most recent call last)
<ipython-input-22-3cceca91fd37> in <module>()
----> 1 np.random.randint(np.iinfo(np.int64).min,np.iinfo(np.int64).max,10)

mtrand.pyx in mtrand.RandomState.randint (numpy\random\mtrand\mtrand.c:10694)()

OverflowError: Python int too large to convert to C long

In [23]: np.__version__
Out[23]: '1.10.1'

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions