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

Binomial distribution random generator.

Pascal
procedure RandomBinom(const AN: Integer; const P: double; const Results: TMtxVecInt; Seed: Integer = -1);

This routine generates Result.Length pseudo random numbers, using the binomial distribution with parameter p. 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 binomial distribution with parameters N=4 and p=0.2.

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