function R = randint(K,varargin)
% RANDINT Generate random non-negative integers
% 
% R = RANDINT(K) generates a random non-negative integer less than K
%
% RANDINT(K,N) returns an N-by-N matrix.
% RANDINT(K,M,N) and RANDINT(K,[M N]) are M-by-N matrices with
% random entries.
% RAND(K,M,N,P,...) or RAND(K,[M,N,P,...]) generates random arrays.
	
  if length(varargin)>0
	R = floor(rand(varargin{:})*K);
  else
	R = floor(rand*K);
  end;
