L=grand(1,1000,'uin',1,100000); l=length(L); j=1; for j=1:(l-1) do for i=1:(l-j) do if L(i+1)