% MAGICPERM  Do 1.20 in NCM.

for n = 3:5
  A = magic(n);
  
  for k=1:2

    if k==2
      p = randperm(n);
      q = randperm(n);
      A = A(p,q);
    end
    
    sum(A)
    sum(A')'
    sum(diag(A))
    sum(diag(flipud(A)))
    rank(A)
    disp(' ')

  end
end
