Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,22 @@
#TESTSTR="1223334444"
NewMap uchar.i() : Define.d e
Procedure.d nlog2(x.d) : ProcedureReturn Log(x)/Log(2) : EndProcedure
Procedure countchar(s$, Map uchar())
If Len(s$)
uchar(Left(s$,1))=CountString(s$,Left(s$,1))
s$=RemoveString(s$,Left(s$,1))
ProcedureReturn countchar(s$, uchar())
EndIf
EndProcedure
countchar(#TESTSTR,uchar())
ForEach uchar()
e-uchar()/Len(#TESTSTR)*nlog2(uchar()/Len(#TESTSTR))
Next
OpenConsole()
Print("Entropy of ["+#TESTSTR+"] = "+StrD(e,15))
Input()