Skip to content

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

Closed
wants to merge 8 commits into from

Conversation

bashtage
Copy link
Contributor

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

@charris
Copy link
Member

charris commented Aug 18, 2017

Note that #8717 allows zero size arrays. I haven't checked if this does that, but might be worth consiering.

@bashtage
Copy link
Contributor Author

I saw that - it will be a small fix to this but wanted to make sure it was getting in before incorporating it.

@bashtage bashtage force-pushed the refactor-randint-core branch 4 times, most recently from 366ebc0 to 80b9a3f Compare August 21, 2017 09:42
@bashtage
Copy link
Contributor Author

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
@bashtage bashtage force-pushed the refactor-randint-core branch from 80b9a3f to 7c88a9c Compare August 31, 2017 08:38
@bashtage
Copy link
Contributor Author

This is currently in randomgen and may make it through there. Not essential here.

@bashtage bashtage closed this Mar 20, 2019
@bashtage bashtage deleted the refactor-randint-core branch April 15, 2019 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants