-
-
Notifications
You must be signed in to change notification settings - Fork 12
Fix Geometric::new for small p>0 #36
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
Conversation
| // NOTE: Some distributions have tests checking only that samples can be | ||
| // generated. This is redundant with vector and correctness tests. | ||
|
|
||
| /// An RNG which panics on first use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the usage for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test I added needs an RNG to call sample but doesn't actually use it.
This allows asserting that the call to sample doesn't use the RNG.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(The name is dubious, but I don't think NeverRng or DummyRng is any better.)
src/geometric.rs
Outdated
|
|
||
| impl Geometric { | ||
| /// Construct a new `Geometric` with the given shape parameter `p` | ||
| /// (probability of success on each trial). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add: If p is zero or 1.0 - p rounds to 1.0 we return u64::MAX
Either make it like this or have it as implementation detail potentially subject to change.
benjamin-lieser
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
|
I'll ignore the test failure here (not relevant to this PR). |
CHANGELOG.mdentrySummary
The case where
p>0but1 - prounds to 1 was not previously handled. Now we handle it the same as forp=0.Fixes #34.