Code covered by the BSD License  

Highlights from
Generation of Random Variates

image thumbnail

Generation of Random Variates

by

James Huntley (view profile)

 

generates random variates from over 870 univariate distributions

erdos_cdf(x)
% erdos_cdf.m - test an Erdos and Kac Cumulative Distribution.
%   See "Generating Nonuniform Random Variates", Chap., 4, L. Devroye.
%
%   Created by:  J. Huntley,  09/08/06
%
     
function [cdf] = erdos_cdf(x)
     
coef = 4/pi;
jmax = 10;

sum1 = 0;
for jm = 1:jmax
    sum1 = sum1 + (-1)^(jm-1)*exp(-0.125* (2*jm-1)^2 * pi^2 / x^2)/(2*jm-1);
end
cdf = coef*sum1;

return

Contact us