RosettaCodeData/Task/Entropy/EasyLang/entropy.easy
2026-02-01 16:33:20 -08:00

12 lines
226 B
Text

func entropy s$ .
len d[] 255
for c$ in strchars s$
d[strcode c$] += 1
.
for cnt in d[] : if cnt > 0
prop = cnt / len s$
entr -= prop * log prop 2
.
return entr
.
print entropy "1223334444"