-
-
Notifications
You must be signed in to change notification settings - Fork 12.1k
randint output have different dtype on Linux and Windows #10317
Copy link
Copy link
Closed
Description
The output dtype of np.random.randint is not cross-platform compatible,
import numpy as np
np.random.randint(10, size=2).dtypeproduces an array of int64 on Linux and an array of int32 on Windows.
Tested versions,
import platform; print(platform.platform())
import sys; print("Python", sys.version)
import numpy; print("NumPy", numpy.__version__)Linux
Linux-3.19.0-58-generic-x86_64-with-debian-jessie-sid
Python 3.6.3 |Anaconda, Inc.| (default, Nov 20 2017, 20:41:42) [GCC 7.2.0]
NumPy 1.13.3
Windows
Windows-10-10.0.14393-SP0
Python 3.6.3 |Anaconda, Inc.| (default, Nov 8 2017, 15:10:56) [MSC v.1900 64 bit (AMD64)]
NumPy 1.13.3
This is due to the fact that the default input parameter is dtype='l'. I saw that there was a lot of related discussion leading to #6910 but I was wondering if there were reasons that prevented setting dtype=np.int64 by default there.
The current behaviour is problematic with any typed code (e.g. Cython / GPU related), and, for instance led to maciejkula/spotlight#82
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels