in Source/Shared/arcana/algorithm.h [291:308]
inline const T standard_deviation(IteratorT from, IteratorT to, ModifierT&& modifier)
{
const auto n = std::distance(from, to);
if (n <= 1)
{
assert(false && "your collection cannot have less than two items");
return {};
}
const auto calculatedMean = mean<T>(from, to, modifier);
const auto accum = sum<T>(from, to, [&](const typename IteratorT::value_type& currentValue)
{
T delta = modifier(currentValue) - calculatedMean;
return delta * delta;
});
return std::sqrt(accum / (n - 1));
}