for examplebecause the ascii value for "ais and "zis sum will always be in the range to for string of ten upper case letters for hash table of size or lessa good distribution results with all slots in the table accepting either two or three of the values in the key range for hash table of size the distribution is terrible because only slots to can possibly be the home slot for some key value example here is much better hash function for strings long sfold(string sint mint intlength length( long sum for (int intlengthj++char [ substring( ( tochararray()long mult for (int lengthk++sum + [kmultmult * char [ substring(intlength tochararray()long mult for (int lengthk++sum + [kmultmult * return(math abs(summ)this function takes string as input it processes the string four bytes at timeand interprets each of the four-byte chunks as single (unsignedlong integer value the integer values for the four-byte chunks are added together in the endthe resulting sum is converted to the range to using the modulus operator for exampleif the string "aaaabbbbis passed to sfoldthen the first four bytes ("aaaa"will be interpreted as the integer value , , , recall from section that the implementation for mod on many +and java compilers will yield negative number if is negative implementors for hash functions need to be careful that their hash function does not generate negative number this can be avoided either by insuring that is positive when computing mod mor adding to the result if mod is negative all computation in sfold is done using unsigned long values in part to protect against taking the modulus of an negative number