pub fn new(r: f64, p: f64) -> Result<NegativeBinomial> {
        if p.is_nan() || p < 0.0 || p > 1.0 || r.is_nan() || r < 0.0 {
            Err(StatsError::BadParams)
        } else {
            Ok(NegativeBinomial { p: p, r: r })
        }
    }
/// Constructs a new negative binomial distribution
/// with a given `p` probability of the number of successes `r`
///
/// # Errors
///
/// Returns an error if `p` is `NaN`, less than `0.0`,
/// greater than `1.0`, or if `r` is `NaN` or less than `0`
///
/// # Examples
///
/// ```
/// use statrs::distribution::NegativeBinomial;
///
/// let mut result = NegativeBinomial::new(4.0, 0.5);
/// assert!(result.is_ok());
///
/// result = NegativeBinomial::new(-0.5, 5.0);
/// assert!(result.is_err());
/// ```
Constructs a new negative binomial distribution
with a given `p` probability of the number of successes `r`
Constructs a new negative binomial distribution with a given ` p ` probability of the number of successes ` r `
pub fn new(r: f64, p: f64) -> Result<NegativeBinomial> {
        if p.is_nan() || p < 0.0 || p > 1.0 || r.is_nan() || r < 0.0 {
            Err(StatsError::BadParams)
        } else {
            Ok(NegativeBinomial { p: p, r: r })
        }
    }
pub fn new ( r : f64 , p : f64 ) -> Result < NegativeBinomial > { if p . is_nan ( ) || p < 0.0 || p > 1.0 || r . is_nan ( ) || r < 0.0 { Err ( StatsError :: BadParams ) } else { Ok ( NegativeBinomial { p : p , r : r } ) } }
Constructs a new negative binomial distribution
with a given `p` probability of the number of successes `r`
Constructs a new negative binomial distribution with a given ` p ` probability of the number of successes ` r `
r
f64
p
f64
r
f64
p
f64
errors
Returns an error if `p` is `NaN`, less than `0.0`,
greater than `1.0`, or if `r` is `NaN` or less than `0`
Returns an error if ` p ` is ` NaN ` less than ` 0 . 0 ` greater than ` 1 . 0 ` or if ` r ` is ` NaN ` or less than ` 0 `
examples
```
use statrs::distribution::NegativeBinomial.

let mut result = NegativeBinomial::new(4.0, 0.5);
assert!(result.is_ok()).


` ` ` use statrs :: distribution :: NegativeBinomial . let mut result = NegativeBinomial :: new ( 4 . 0 0 . 5 ) ; assert! ( result . is_ok () ) .