From: Jérôme Benoit Date: Sat, 16 Sep 2023 08:27:45 +0000 (+0200) Subject: refactor: cleanup standard deviation implementation X-Git-Tag: v1.2.22~10 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=4e1c771b331a8e3f42aa83eced5673df93d2df49;hp=b2c628b68243d8f0fd884e76f51ca4583038814a;p=e-mobility-charging-stations-simulator.git refactor: cleanup standard deviation implementation Signed-off-by: Jérôme Benoit --- diff --git a/src/utils/StatisticUtils.ts b/src/utils/StatisticUtils.ts index 7f338ff9..f0bd1f28 100644 --- a/src/utils/StatisticUtils.ts +++ b/src/utils/StatisticUtils.ts @@ -69,8 +69,7 @@ export const stdDeviation = ( dataSetAverage: number = average(dataSet), ): number => { return Math.sqrt( - dataSet.reduce((accumulator, num) => { - return accumulator + Math.pow(num - dataSetAverage, 2); - }, 0) / dataSet.length, + dataSet.reduce((accumulator, num) => accumulator + Math.pow(num - dataSetAverage, 2), 0) / + dataSet.length, ); };