public int[] shuffle(){
  int[] ans=Arrays.copyOf(nums,nums.length);
  for (int i=1; i < nums.length; i++) {
    swap(ans,i,random.nextInt(i + 1));
  }
  return ans;
}

public int [ ] shuffle ( ) { int [ ] ans = Arrays . copyOf ( nums , nums . length ) ; for ( int i = 1 ; i < nums . length ; i ++ ) { swap ( ans , i , random . nextInt ( i + 1 ) ) ; } return ans ; }
returns a random shuffling of the array .
