-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
ENH: Add broadcasting to randint #9576
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
969ac61
to
8b401b2
Compare
Note that #8717 allows zero size arrays. I haven't checked if this does that, but might be worth consiering. |
I saw that - it will be a small fix to this but wanted to make sure it was getting in before incorporating it. |
366ebc0
to
80b9a3f
Compare
I think this is finished, modulo reviews. It closes #8717 although I didn't put in the tests for empty choice. |
Refactor to allow consistent generation across multiple inputs for use in broadcasting
Add broadcasting for randint
Remove old rand int helpers Add tests for array versions Remove mask generator xref numpy#6938 xref numpy#6902 xref numpy#6745
Add fast path when size is not None and inputs are 1d or less since size will uniquely determine output
Refactor to avoid unnecessary repetition
Allow randint to handle zero size arrays to allow choice to function on empty inputs xref numpy#8717
Add tests that must take vector path to ensure it is tests
Add tests that must take vector path to ensure it is tests Replace np.bool_ with python bool
80b9a3f
to
7c88a9c
Compare
This is currently in randomgen and may make it through there. Not essential here. |
Continuation of @gfyoung 's initial patch but using a different approach. This essentially produces a complete random integer generator including arg checks for each type. The int64/uint64 cases uses a separate path since special handling is required to ensure cast values are in bounds.
Related PR's and Issues: #6938 #6902 #6745