function [x] = rng25(n,x0)

a = int32(6) ;     % Multiplicative constant
c = int32(7) ;     % Additive constant
m = int32(25) ;    % Modulus
persistent s       % State

if nargin > 1,
   % If x0 is given, we use it as the seed
   s = int32(x0) ;
elseif isempty(s),
   % If no state is set, we use a hardcoded one.
   s = 11 
end 

% Start with an empty array
x = [] ;

% Iterate n times to generate an array of random numbers
for i=1:n,
   s = mod(a*s + c, m ) ;
   x = [ x s ] ;
end
 
