public static byte[] getRandomArray(final int numOfTiles, final boolean keepZeroInCorner) {
		final byte[] tiles = new byte[numOfTiles];
		for (int i = numOfTiles - 2; i >= 0; --i) {
			tiles[i] = (byte) (i + 1);
		}
		tiles[numOfTiles - 1] = 0;
		int maxTilesToSwap;
		if (keepZeroInCorner) {
			maxTilesToSwap = numOfTiles - 1;
		} else {
			maxTilesToSwap = numOfTiles;
		}
		final Random random = new Random();
		for (int i = 49; i >= 0; --i) {
			final int rand1 = random.nextInt(maxTilesToSwap);
			int rand2 = random.nextInt(maxTilesToSwap);
			if (rand1 == rand2) {
				if (rand1 < (maxTilesToSwap << 1)) {
					rand2 = random.nextInt(maxTilesToSwap - rand1) + rand1;
				} else {
					rand2 = random.nextInt(rand1);
				}
			}
			swap(rand1, rand2, tiles);
		}
		if (!isValidPermutation(tiles)) {
			if (tiles[0] != 0 && tiles[1] != 0) {
				swap(0, 1, tiles);
			} else {
				swap(2, 3, tiles);
			}
		}
		return tiles;
	}