this is my first post in this forum, so please allow me some short introduction:I haven't programmed in BASIC for decades (yes, I'm an oldie) but recently gave free BASIC a try, because it can produce 64-bit-code.

This function calculates the Index of coincidence for a string. The string is in lower case containing only "a" to "z" - all other charcters are removed.

Function CI(Text As String) As Double Dim As Integer i,j,l Dim As Double su,ah (1 To 26),tmp For i=1 To 26 ' array ah() counts the frequency of the letters in Text ah(i)=0 ' ah(0)=number of "a"'s, ah(1)=number of "b"'s, and so on Next ' as it is declared local, its not necessary to initialize it, right? meaning i could skip this entirely?

l=Len(Text) For i=1 To l j=Asc(Mid(Text,i,1))-96 ' j=Text[i-1]-96 would be same, but faster? ah(j)+=1 Next For i=1 To 26 tmp=ah(i)*(ah(i)-1) su=su+tmp Next tmp=l*(l-1) su=su/tmp CI=su ; return su would be same? Which is better?