mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2024-11-14 19:46:29 +08:00
12 lines
310 B
JavaScript
12 lines
310 B
JavaScript
module.exports = {
|
|
roundTo2(num) {
|
|
return Math.round((num + Number.EPSILON) * 100) / 100;
|
|
},
|
|
stdDev(array) {
|
|
const n = array.length;
|
|
const mean = array.reduce((a, b) => a + b) / n;
|
|
return Math.sqrt(
|
|
array.map((x) => Math.pow(x - mean, 2)).reduce((a, b) => a + b) / n
|
|
);
|
|
},
|
|
};
|