We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a45c124 commit ed1b718Copy full SHA for ed1b718
src/geometric.rs
@@ -67,8 +67,14 @@ impl fmt::Display for Error {
67
impl std::error::Error for Error {}
68
69
impl Geometric {
70
- /// Construct a new `Geometric` with the given shape parameter `p`
71
- /// (probability of success on each trial).
+ /// Construct a new `Geometric` distribution
+ ///
72
+ /// The shape parameter `p` is the probability of success on each trial.
73
74
+ /// ### Edge cases
75
76
+ /// If `p == 0.0` or `1.0 - p` rounds to `1.0` then sampling returns
77
+ /// `u64::MAX`.
78
pub fn new(p: f64) -> Result<Self, Error> {
79
let mut pi = 1.0 - p;
80
if !p.is_finite() || !(0.0..=1.0).contains(&p) {
0 commit comments