public void writeReference(COSBase obj) throws IOException {
        COSObjectKey key = getObjectKey(obj);
        float randomThreshold = config.getRandomizeRefNumbers();
        float r = random.nextFloat();
        if (randomThreshold > 0.0f && r < randomThreshold) {
            long num = random.nextInt(roughNumberOfObjects);
            LOG.debug("corrupting ref number: " + key.getNumber() + " -> " + num);
            getStandardOutput().write(String.valueOf(num).getBytes(StandardCharsets.ISO_8859_1));
        } else {
            getStandardOutput().write(
                    String.valueOf(key.getNumber()).getBytes(StandardCharsets.ISO_8859_1));

        }
        getStandardOutput().write(SPACE);
        getStandardOutput().write(
                String.valueOf(key.getGeneration()).getBytes(StandardCharsets.ISO_8859_1));
        getStandardOutput().write(SPACE);
        getStandardOutput().write(REFERENCE);
    }
visitFromObjRef method comment.

@param obj The object that is being visited.
@throws IOException If there is an exception while visiting this object.
tika-fuzzing/src/main/java/org/apache/tika/fuzzing/pdf/EvilCOSWriter.java