Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Bernoulli constructor #799

Closed
Closed

Description

@dhardy

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?

Activity

  1. vks commented on May 16, 2019

    @vks
    Contributor

    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.)

  2. added a commit that references this issue on May 22, 2019
    c6bce2c
  3. added a commit that references this issue on Feb 5, 2025
    5265ebd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions