function r = levyrnd(varargin)

if nargin == 1
mu = 0;
sigma = 1;
elseif nargin == 2
mu = varargin{1};
sigma = 1;
elseif nargin == 3
mu = varargin{1};
sigma = varargin{2};

end

r = mu - tan(pi*(rand(size(varargin{1}, 1), size(varargin{1}, 2)) - 0.5))*sigma;
end