UNPKG

kruonis

Version:
12 lines (11 loc) 412 B
"use strict"; 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;