kruonis
Version:
A tool to perform benchmarks on TS
12 lines (11 loc) • 412 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.StandardDeviation = void 0;
class StandardDeviation {
calculate(values) {
const N = values.length;
const mean = values.reduce((acc, val) => acc + val, 0) / N;
return Math.sqrt(values.reduce((acc, val) => acc + Math.pow(val - mean, 2), 0) / N);
}
}
exports.StandardDeviation = StandardDeviation;
;