Skip to content

Conversation

marcpabst
Copy link
Contributor

  • Added a CHANGELOG.md entry

Summary

Add accessor for Bernoulli returning the probbability of true

Motivation

There is currently no way to obtain p.

I'm happy to extend this PR with similiar smale-scale changes for other distributions.

There should be a way to obtain the probability of `true`.
@benjamin-lieser
Copy link
Member

This does not compile. From is for lossless and error-less conversions only. If you need to cast a u64 to a f64 you should use as and be aware that you might loose precision, which should be fine in this case.

@marcpabst
Copy link
Contributor Author

Oh god, I pushed the wrong commit! Sorry, will push an actually working one later!

@dhardy dhardy added the D-changes Do: changes requested label Aug 12, 2024
CHANGELOG.md Outdated
@@ -20,6 +20,7 @@ You may also find the [Upgrade Guide](https://rust-random.github.io/book/update.
- Fix portability of `rand::distributions::Slice` (#1469)
- Rename `rand::distributions` to `rand::distr` (#1470)
- The `serde1` feature has been renamed `serde` (#1477)
- Add `p()` for `Bernoulli` to access probability.
Copy link
Member

Choose a reason for hiding this comment

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

Please include the PR: #1481

@dhardy dhardy merged commit 8b455dd into rust-random:master Oct 17, 2024
14 checks passed
benjamin-lieser pushed a commit to benjamin-lieser/rand that referenced this pull request Oct 24, 2024
Co-authored-by: Diggory Hardy <git@dhardy.name>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
D-changes Do: changes requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants