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

schmeis_rnd(p_value,nsamples)
% schmeis_rnd.m - generates 'nsamples' of a Schmeiser-Deutsch random variable.
%   See "Random Variate Generation in One Line of Code", L. Devroye.
%
%   Created by: J. Huntley,  09/25/06
%

function [jhold,xhold] = schmeis_rnd(p_value,nsamples)

lambda = p_value(1);
mu = p_value(2);
U = rand(1,nsamples);
jhold = (1:nsamples);
xhold = sign(U-lambda) .* (abs(U-lambda)).^mu;

return

Contact us