src/org/kocakosm/pitaya/util/XArrays.java
public static int[] shuffle(int[] a, Random rnd)
	{
		int[] copy = copyOf(a);
		for (int i = copy.length; i > 1; i--) {
			swap(copy, i - 1, rnd.nextInt(i));
		}
		return copy;
	}
public static int[] shuffle(int[] a, Random rnd)
	{
		int[] copy = copyOf(a);
		for (int i = copy.length; i > 1; i--) {
			swap(copy, i - 1, rnd.nextInt(i));
		}
		return copy;
	}
Returns a copy of the given array where its element have been randomly
permuted using the specified source of randomness. All permutations
occur with equal likelihood assuming that the source of randomness is
fair. This method uses the optimized version of the Fisher-Yates shuffle
algorithm (Fisher, Yates, Durstenfeld, Knuth) and thus runs in linear
time.

@param a the array whose content will be shuffled.
@param rnd the source of randomness to use.

@return the shuffled array.

@throws NullPointerException if one of the arguments is {@code null}.