HH\Lib\Math\mean

Meta Engineer?

This is available as Math\mean in the www repository.

Returns the arithmetic mean of the numbers in the given container

namespace HH\Lib\Math;

function mean(
  Container<num> $numbers,
): ?float;

Parameters

Returns

  • ?float

Examples

$v = vec[1, 2, 3, 4, 5];
$mean = Math\mean($v);
echo "Mean of the array is $mean \n"; // Output: Mean of the array is 3