<commit_before>package vpork

import java.util.concurrent.ConcurrentLinkedQueue

class StatList {
    ConcurrentLinkedQueue<Double> vals = []

    def leftShift(double b) {
        vals.add(b)
    }

    def getAverage() {
        double total = 0
        vals.each { total += it }
        total / vals.size()
    }

    double getPercentile(double p) {
        List vList = vals.sort()
        int idx = p * (double)vList.size()
        vList[idx]
    }
}<commit_msg>If no values yet, return NaN for percentile<commit_after>package vpork

import java.util.concurrent.ConcurrentLinkedQueue

class StatList {
    ConcurrentLinkedQueue<Double> vals = []

    def leftShift(double b) {
        vals.add(b)
    }

    def getAverage() {
        double total = 0
        vals.each { total += it }
        total / vals.size()
    }

    double getPercentile(double p) {
        if (!vals) {
            return Double.NaN
        }
        
        List vList = vals.sort()
        int idx = p * (double)vList.size()
        vList[idx]
    }
}
{'fraction_non_alphanumeric': 0.10521235521235521, 'fraction_numerical': 0.0019305019305019305, 'mean_word_length': 1.9798850574712643, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3383463', 'n_tokens_mistral': 341, 'n_tokens_neox': 323, 'n_words': 77}