private byte[] swap(byte[] ret) {
        if (ret.length == 0) {
            return new byte[0];
        }
        int srcStart = random.nextInt(ret.length);
        int targStart = random.nextInt(ret.length);
        //these spans can overlap;

        int len = random.nextInt(maxSpanLength);
        int maxStart = Math.max(srcStart, targStart);
        len = (len + maxStart < ret.length) ? len : ret.length - maxStart;

        byte[] landingBytes = new byte[len];
        //copy the landing zone
        System.arraycopy(ret, targStart, landingBytes, 0, len);
        //now copy the src onto the targ
        System.arraycopy(ret, srcStart, ret, targStart, len);
        //now copy the targ over to the src
        System.arraycopy(landingBytes, 0, ret, srcStart, len);
        return ret;
    }
randomly swaps spans from the input
tika-fuzzing/src/main/java/org/apache/tika/fuzzing/general/SpanSwapper.java