Character-frequency distribution
= Character-frequency distribution
{title2=$p(c)=\#\{i:s_i=c\}/|s|$}
For a nonempty <string>, assign a character its occurrence count divided by the <string> length. Counts partition the character positions, proving normalization. Empty input has no total count to normalize and needs an explicit alternative contract or rejection. A <Scala> Char implementation counts UTF-16 code units unless a separate code-point representation is introduced.