CynicRus
2013-02-26 13:09:12
function RandomBinom(n, p: Extended): Extended;
var
x: Extended;
i: Integer;
begin
x := 0;
for i := 1 to Round(n) do
if Random - p <= 0 then x := x + 1;
Result := x
end;Cheers,
Cynic.
2013-02-26 13:09:12
function RandomBinom(n, p: Extended): Extended;
var
x: Extended;
i: Integer;
begin
x := 0;
for i := 1 to Round(n) do
if Random - p <= 0 then x := x + 1;
Result := x
end;2013-02-26 13:19:51
2013-02-28 14:14:58
From: nivek1989
Edit: Use case would make sense as a random number with a binomial distribution. Doesn't GaussRand() cover that though?
2013-02-28 14:54:28
From: Turpinator
Gaussian/Normal Distribution is continuous whereas a Binomial Distribution is discrete (only allowing for specified values like an integer range).
Allsooo… Binomial is used to 'count the number of successes until failures' in a line of independent success/fail experiments.
So, they have different applications.
2013-03-01 13:27:34
From: nivek1989
So what I do seem to gather is this is roughly the same as a Gaussian distribution, however focused on an Integer return, which could be done via Round(Gauss())?