function p=permuternd(n)
%  generates a random permutation of the integers 1:n
p=1:n;
for k=n:-1:2
    i=ceil(k*rand);
    q=[p(i) p(k)];
    p(k)=q(1) ;p(i)=q(2);
end

    
