for (i=0;i<26;i++) { val += (counts[i]*(counts[i]-1)) / (total*(total-1)); }