Skip to content
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

throw error when rng sampler is fed empty array #47104

Merged
merged 2 commits into from
Oct 20, 2022

Conversation

Moelf
Copy link
Contributor

@Moelf Moelf commented Oct 8, 2022

fix #46272

@rikhuijzer
Copy link
Contributor

Shouldn't there be a test?

@rfourquet
Copy link
Member

Note that rand(()) would still throw the same "range must be non-empty" error. What about changing the existing wording to "collection must be non-empty", which will still be correct for ranges, and will be identical to the message for empty dicts and sets. (Also it will avoid to make this check twice, although the cost is probably negligible).

@rfourquet rfourquet added the randomness Random number generation and the Random stdlib label Oct 8, 2022
@Moelf Moelf force-pushed the earlier_error_msg_rand_empty_array branch from 725f3da to 8077af3 Compare October 9, 2022 00:03
@ViralBShah
Copy link
Member

@rfourquet Please merge whenever you think ok.

Copy link
Member

@rfourquet rfourquet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, can you check the CI errors are all unrelated?

@Moelf
Copy link
Contributor Author

Moelf commented Oct 19, 2022

I think so, purely because how unreliable our CI is

@rfourquet rfourquet merged commit f4c4c33 into JuliaLang:master Oct 20, 2022
@Moelf Moelf deleted the earlier_error_msg_rand_empty_array branch October 20, 2022 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
randomness Random number generation and the Random stdlib
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bad error message in rand([])
4 participants