X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Futils.ts;h=ed118da6b5e10165d23c2f6820af73e9ed7f02bb;hb=a4958de2101f06e7096b83adbca82fcfd532a721;hp=f30e175c05dd9b20561f8b82f36beaa93946584e;hpb=138d29a820e8a61d10ba03fe42c5d77596ef788c;p=poolifier.git diff --git a/src/utils.ts b/src/utils.ts index f30e175c..ed118da6 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -28,7 +28,7 @@ export const median = (dataSet: number[]): number => { const sortedDataSet = dataSet.slice().sort((a, b) => a - b) const middleIndex = Math.floor(sortedDataSet.length / 2) if (sortedDataSet.length % 2 === 0) { - return sortedDataSet[middleIndex / 2] + return sortedDataSet[middleIndex] } return (sortedDataSet[middleIndex - 1] + sortedDataSet[middleIndex]) / 2 }