function [out]=randint(bottom,top)

%   randint

%   This software is protected by german copyright and international treaties.             
%   Copyright 2004 Markus Junghöfer & Peter Peyk. All Rights Reserved.                     
%                                                                                          
%   THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE        
%   NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO,    
%   WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE    
%   OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS,
%   TRADEMARKS OR OTHER RIGHTS. COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT,       
%   INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE      
%   OR DOCUMENTATION.                                                                      

if top<=bottom
    disp('Invalid limits in randint.m')
    return
end
if mod(bottom,round(bottom))~=0
   disp('Only integer limits for randint.m')
    return
end 
if mod(top,round(top))~=0
   disp('Only integer limits for randint.m')
    return
end 

%randomgenerator initialisieren
%------------------------------
rand('state',sum(100*clock));

%ziehen
%---------
toptmp=top+1;
diff=toptmp-bottom;
if diff < 1
    disp('error in randint.m: invalid rangelimits');
    return
else
    out=floor(rand*(diff))+bottom;
end


return