I'm confused about this part right here:
'a' + rand() % 26
The rand() function returns an integral number in the range between 0 and RAND_MAX. I assume RAND_MAX here is 26. And this is randomly return one of the 26 letters of the alphabet. But what is the point of the 'a' here?
If I want a random number between 5 and 10, then that means that 5 is the minimum, and 10 the maximum.
Therefore:
5 + (rand()%10)
In ascii, 'a' is 97 in decimal.
The purpose of the 'a' in this case, is to create a random number and then add 'a'(97), the minimum, to it. Otherwise, you'd be creating characters from 0-25