public List<COSName> getFilters(COSBase existingFilters) {
        if (maxFilters < 0) {
            List<COSName> ret = new ArrayList<>();
            if (existingFilters instanceof COSArray) {
                for (COSBase obj : ((COSArray) existingFilters)) {
                    ret.add((COSName) obj);
                }
            } else if (existingFilters instanceof COSName) {
                ret.add((COSName) existingFilters);
            }
            return ret;
        }

        int numFilters;
        if (maxFilters - minFilters == 0) {
            numFilters = maxFilters;
        } else {
            numFilters = minFilters + random.nextInt(maxFilters - minFilters);
        }

        List<COSName> allowable = new ArrayList<>(allowableFilters);

        List<COSName> filters = new ArrayList<>();
        for (int i = 0; i < numFilters; i++) {
            int index = random.nextInt(allowable.size());
            filters.add(allowable.get(index));
        }
        return filters;
    }
If {@link #maxFilters} &gt; 0, this will randomly select filters given
the {@link #maxFilters} and {@link #minFilters}.  If {@link #maxFilters} < 0,
this will return the existing filters.

@param existingFilters
@return
tika-fuzzing/src/main/java/org/apache/tika/fuzzing/pdf/PDFTransformerConfig.java