You are here: Symbol Reference > StatRandom Namespace > Functions > StatRandom.RandomNegBinom Function
Stats Master VCL
ContentsIndex
PreviousUpNext
StatRandom.RandomNegBinom Function

Negative binomial distribution random generator.

Pascal
procedure RandomNegBinom(const R: double; const p: double; const Results: TMtxVecInt; Seed: Integer = -1);

This routine generates Result.Length pseudo random numbers, using the hypergeometric distribution with parameters M, K and N. The random numbers are stored in the Results vector. An exception is raised if Result vector is complex.

Generate 2000 random numbers by using the hypergeometric distribution with parameters M=100, K=50 and N=30.

Uses MtxExprInt, StatRandom;
procedure Example;
  var Res: VectorInt;
begin
  Res.Size(2000);
    RandomHegBinom(10,0.2, Res);
end;
#include "MtxExprInt.hpp"
#include "StatRandom.hpp"
void __fastcall Example()
{
  sVector Res;
  Res.Size(2000,false);
  RandomNegBinom(10, 0.2, Res, -1);
}
Examples on GitHub
Copyright (c) 1999-2024 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!