UNB/ CS/ David Bremner/ teaching/ java/ randomPerm.java
public static int [] randomPerm(int len){
  int [] perm=new int[len];
  Random generator = new Random();
  for (int i=0; i<len; i++){
    perm[i]=i+1;
  }
  for (int i=0; i<len; i++){
      int offset = generator.nextInt(len-i);
      swap(perm,i,i+offset);
  }
  return perm;
}