nb2_ran

Function nb2_ran 

Source
pub fn nb2_ran(r: i32, p: f64) -> i32
Expand description

Random draw from X ~ NB(r, p) distribution where X = the trial on which the rth success is observed.

§Parameters

  • r = r,r+1,r+2,...
  • p = probability of success (0 < p <= 1)

§Example

Suppose X ~ NB(r=2, p=0.6). Use

use ruststat::nb2_ran;
println!("Random draw: {}", nb2_ran(2, 0.6));