function out=shuffle(a)
       n=length(a)
       for i=n:-1:1
         j=i*random
         swap(a(i),a(j))
       endfor
       out=a;
     function swap(i1,i2)
       temp=i1;
       i1=i2;
       i2=i1;
     endfunction 
endfunction