Code covered by the BSD License  

Highlights from
Generation of Random Variates

image thumbnail

Generation of Random Variates


James Huntley (view profile)


generates random variates from over 870 univariate distributions

lsuccess_pdf(n, p, nn)
% lsuccess_pdf.m - evaluates Length of Longest Success Run Probability Density.
%   See "Simple Expressions for Success Run Distributions in Bernoulli Trials",
%   M. Muselli, Genoa.
%  Created by Jim Huntley,  01/02/08

function [pdf] = lsuccess_pdf(n, p, nn)

if(n == 1)
    cdf = lsuccess_cdf(1, p, nn);
    pdf = cdf(1);
elseif(n > 1)
    cdf2 = lsuccess_cdf(n, p, nn);
    cdf1 = lsuccess_cdf(n-1, p, nn);
    pdf = cdf2 - cdf1;


Contact us