https://www.mathworks.com/help/stats/nbinrnd.html
nbinrnd - Negative binomial random numbers - MATLAB
This MATLAB function generates a random number drawn from the negative binomial distribution with the corresponding number of successes r and the probability...
negative binomialrandom numbersmatlab