static public <T>void shuffle(List<T> list,Random rand,int lastIndex){
  int i, j, size=lastIndex - 1;
  for (i=0; i < size; i++) {
    j=rand.nextInt(size - i) + i + 1;
    swap(list,i,j);
  }
}

static public < T > void shuffle ( List < T > list , Random rand , int lastIndex ) { int i , j , size = lastIndex - 1 ; for ( i = 0 ; i < size ; i ++ ) { j = rand . nextInt ( size - i ) + i + 1 ; swap ( list , i , j ) ; } }
a slightly modified version of durstenfeld ' s shuffle algorithm .
