private int[] randomize(int[] array,Random generator){
  int index;
  int temp;
  int[] newArray=new int[array.length];
  System.arraycopy(array,0,newArray,0,array.length);
  for (int j=newArray.length - 1; j > 0; j--) {
    index=(int)(generator.nextDouble() * (double)j);
    temp=newArray[j];
    newArray[j]=newArray[index];
    newArray[index]=temp;
  }
  return newArray;
}

private int [ ] randomize ( int [ ] array , Random generator ) { int index ; int temp ; int [ ] newArray = new int [ array . length ] ; System . arraycopy ( array , 0 , newArray , 0 , array . length ) ; for ( int j = newArray . length - 1 ; j > 0 ; j -- ) { index = ( int ) ( generator . nextDouble ( ) * ( double ) j ) ; temp = newArray [ j ] ; newArray [ j ] = newArray [ index ] ; newArray [ index ] = temp ; } return newArray ; }
returns a copy of the array with its elements randomly redistributed .
