MCPcopy Create free account
hub / github.com/DavidHDev/react-bits / median

Function median

src/content/Backgrounds/GridScan/GridScan.jsx:875–880  ·  view source on GitHub ↗
(buf)

Source from the content-addressed store, hash-verified

873}
874
875function median(buf) {
876 if (buf.length === 0) return 0;
877 const a = [...buf].sort((x, y) => x - y);
878 const mid = Math.floor(a.length / 2);
879 return a.length % 2 ? a[mid] : (a[mid - 1] + a[mid]) * 0.5;
880}
881
882function centroid(points) {
883 let x = 0,

Callers 1

detectFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected