]> zoso.dev Git - nano-pow.git/commitdiff
Fix sorting bug in test page to get correct median.
authorChris Duncan <chris@zoso.dev>
Fri, 25 Apr 2025 20:39:14 +0000 (13:39 -0700)
committerChris Duncan <chris@zoso.dev>
Fri, 25 Apr 2025 20:39:14 +0000 (13:39 -0700)
test/index.html

index 397ef8bba719e51f68c33e0da9858bde82edbe04..b84a6a8d6a151acab5b0d8ab5f91aad68e3966cf 100644 (file)
@@ -35,7 +35,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
 
                function average (times, type, effort) {
                        let count = times.length, truncatedCount = 0, sum = 0, truncated = 0, reciprocals = 0, logarithms = 0, min = Number.MAX_SAFE_INTEGER, max = 0, median = 0, rate = 0
-                       times.sort()
+                       times.sort((a, b) => a - b)
                        for (let i = 0; i < count; i++) {
                                sum += times[i]
                                reciprocals += 1 / times[i]