Code covered by the BSD License  

Highlights from
Generation of Random Variates

image thumbnail

Generation of Random Variates

by

 

generates random variates from over 870 univariate distributions

erdos_pdf(x)
% erdos_pdf.m - generate an Erdos and Kac Probability Density.
%   See "Generating Nonuniform Random Variates", Chap., 4, L. Devroye.
%
%  Created by:  J. Huntley,  09/08/06
%

function [pdf] = erdos_pdf(x)     

coef = 4/pi;
jmax = 10;
          
sum1 = 0;
for jm = 1:jmax
    sum1 = sum1 + 0.25*(-1)^(jm-1)*exp(-0.125* (2*jm-1)^2 * pi^2 / x^2)*(2*jm-1)*pi^2/x^3;
end
pdf = coef*sum1;

return

Contact us