I have to assign numbers to letters a,b,c,d...z such that for a given string and all anagram search we can do it in o(n) using hash search. The hash function is supposedly s[0]+s[1]+s[2]..s[n-1]. Anagram is positional independent so there is no need to multiply with positional powers as in Rabin-Karp.
Choose some convenient prime modulus p (maybe 231 ā 1) and then map each letter to a random number between 0 and pā1 inclusive. It can be shown that, assuming every word has fewer than p of each letter, the probability of a spurious collision between two words is 1/p.