public static int[] randPermuteWithExclusion(int floor,int ceil,int excluded){
  int[] permute=new int[ceil - floor - 1];
  Random randi=new Random();
  int k=floor - 1;
  for (int i=floor; i < ceil; i++) {
    if (i == excluded) {
      continue;
    }
 else {
      k++;
    }
    int j=randi.nextInt(k - floor + 1);
    if (j != k - floor) {
      permute[k - floor]=permute[j];
    }
    permute[j]=i;
  }
  return permute;
}

public static int [ ] randPermuteWithExclusion ( int floor , int ceil , int excluded ) { int [ ] permute = new int [ ceil - floor - 1 ] ; Random randi = new Random ( ) ; int k = floor - 1 ; for ( int i = floor ; i < ceil ; i ++ ) { if ( i == excluded ) { continue ; } else { k ++ ; } int j = randi . nextInt ( k - floor + 1 ) ; if ( j != k - floor ) { permute [ k - floor ] = permute [ j ] ; } permute [ j ] = i ; } return permute ; }
returns a random permutation of all the integers between floor ( inclusive ) and ceil ( exclusive ) with the exception of one number ( excluded ) which is intentionally excluded . this method will fail if excluded
