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

Bernoulli constructor #799

Closed
dhardy opened this issue May 16, 2019 · 1 comment · Fixed by #803
Closed

Bernoulli constructor #799

dhardy opened this issue May 16, 2019 · 1 comment · Fixed by #803

Comments

@dhardy
Copy link
Member

dhardy commented May 16, 2019

In rand_distr we switched all constructors to return a Result unless they couldn't fail to avoid having to panic.

There is one distribution that didn't get updated: Bernoulli, which remains in Rand proper.

Should we make this return a result? For:

  • it's consistent
  • it avoids a panic

Against:

  • it's a breaking change
  • it's less convenient (though we still have Rng::gen_bool for convenience)

I think probably we should, but would like to hear opinions?

@vks
Copy link
Collaborator

vks commented May 16, 2019

We could also add a new, non-panicking constructor and deprecate the old one.

(I think I would prefer a breaking change to rand though. I don't expect there is so much code using Bernoulli directly.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants