<commit_before>define(['../number/MIN_INT', '../number/MAX_INT', '../number/toInt', './countSteps'], function(MIN_INT, MAX_INT, toInt, countSteps){

    /**
     * Gets random integer inside range or snap to min/max values.
     * @version 0.3.0 (2011/11/15)
     * @author <NAME>
     */
    function randInt(min, max, shouldSnap){
        min = min == null? MIN_INT : toInt(min);
        max = max == null? MAX_INT : toInt(max);

        var rnd = Math.random(),
            diff = max - min;

        if (shouldSnap || diff < 2) {
            return rnd < 0.5? min : max;
        }

        return min + countSteps(rnd,  1 / (diff + 1));
    }

    return randInt;
});<commit_msg>simplify math/randInt logic. closes #8.<commit_after>define(['../number/MIN_INT', '../number/MAX_INT', '../number/toInt', './rand'], function(MIN_INT, MAX_INT, toInt, rand){

    /**
     * Gets random integer inside range or snap to min/max values.
     * @version 0.4.0 (2011/11/16)
     * @author <NAME> / <NAME>
     */
    function randInt(min, max, shouldSnap){
        min = min == null? MIN_INT : toInt(min);
        max = max == null? MAX_INT : toInt(max);
        // can't be max + 0.5 otherwise it will round up if `rand`
        // returns `max` causing it to overflow range.
        return Math.round( rand(min - 0.5, max + 0.499999999999, shouldSnap) );
    }

    return randInt;
});
{'fraction_non_alphanumeric': 0.16509775524981898, 'fraction_numerical': 0.03258508327299059, 'mean_word_length': 2.2365339578454333, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, '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': '3351204', 'n_tokens_mistral': 493, 'n_tokens_neox': 455, 'n_words': 129}