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

Function median

src/tailwind/Backgrounds/GridScan/GridScan.jsx:874–879  ·  view source on GitHub ↗
(buf)

Source from the content-addressed store, hash-verified

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

Callers 1

detectFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected