Files
mql5-skills/skills/mql5/references/docs/34-standardlibrary/1260-standardlibrary-mathematics-stat-negativebinomial-mathrandomnegativebinomial.md
T
2026-06-23 21:47:51 +08:00

47 lines
1.4 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# MathRandomNegativeBinomial
Generates a pseudorandom variable distributed according to the law of negative binomial distribution with the r and p parameters. In case of error it returns [NaN](/en/docs/basis/types/double).
```
double  MathRandomNegativeBinomial(
   const double  r,              // number of successful tests
   const double  p,              // probability of success
   int&          error_code      // variable to store the error code
   );
```
Generates pseudorandom variables distributed according to the law of negative binomial distribution with the r and p parameters. In case of error it returns false. Analog of the [rweibull()](https://stat.ethz.ch/R-manual/R-devel/library/stats/html/Weibull.html) in R.
```
bool  MathRandomNegativeBinomial(
   const double  r,              // number of successful tests
   const double  p,              // probability of success
   const int     data_count,     // amount of required data
   double&       result[]        // array with values of pseudorandom variables
   );
```
Parameters
r
[in]  Number of successful tests.
p
[in]  Probability of success.
error_code
[out]  Variable to store the error code.
data_count
[out]  Amount of required data.
result[]
[out]  Array to obtain the values of pseudorandom variables.