function XX = boundary (XX, lower,upper,N,D)
  for i=1:N
    for j=1:D
      if ((XX(i,j)<lower(j))||(XX(i,j)>upper(j)))
        XX(i,j)=lower(j)+(upper(j)-lower(j))*rand;
      end
    end
  end
end
