% buildAddressSpace
% 
% Purpose: This function creates an address space. 
%  Its too big for Matlab, so save it in a file.
  %  Creates one address at a time, 

function aSpace = buildAddressSpace(n,Nprime)
 
   distance = ceil(n/3);
   % at least this different
   k = ceil(n/8);



   aSpace = zeros(Nprime,n);
   for i = 1:Nprime
     
     % A possible address
     y = floor(2*rand(1,n));
     j=1;
     while(j<i) 

        % Has to be at least this different from all the others
      if sum(abs(y-aSpace(j,1:n))) - k >0
       j = j+1;      
      else
        j=1;
        y = floor(2*rand(1,n));
      end
        
     end    
	aSpace(i,1:n) = y;
    
   end
  



