
function ans = randgamint(m,n,l,r)

% randgamint -- Student-t-distributed random generator
% Usage
%   ans = randgamint(m,n,l,r)
% Inputs
%   m,n      dimensions
%   l,r      parameters
%            r HAS TO BE INTEGER
%            default r = l
% Outputs
%   ans      m by n matrix with student-t-distributed data
% Example
%   b = randgamint(2,4,3.1,4) or b = randgamint(size(a),3.1,4)

if (nargin == 3)
  dim = m;
  r = l;
  l = n;
  m = dim(1);
  n = dim(2);
end
y = randexp([m n r],l);
x = sum(y,3);
ans = x ;

