MCPcopy Index your code
hub / github.com/monkeytypegame/monkeytype / mean

Function mean

packages/util/src/numbers.ts:29–37  ·  view source on GitHub ↗
(array: number[])

Source from the content-addressed store, hash-verified

27 * @returns The mean of the input array.
28 */
29export function mean(array: number[]): number {
30 try {
31 return (
32 array.reduce((previous, current) => (current += previous)) / array.length
33 );
34 } catch (e) {
35 return 0;
36 }
37}
38
39/**
40 * Calculates the standard deviation of an array of numbers.

Callers 3

logTimingFunction · 0.90
forceReleaseAllKeysFunction · 0.90
stdDevFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected