import { assert } from "../../assert.js";

/**
 *
 * @param {number[]} values
 * @param {number} [start]
 * @param {number} [end]
 * @returns {number}
 */
export function computeStatisticalMean(values, start = 0, end = values.length) {
    assert.isArray(values, 'value');

    let total = 0;

    const sample_count = end - start;

    for (let i = 0; i < end; i++) {
        const value = values[i];

        total += value;
    }

    return total / sample_count;
}
