line 136: I don't understand the purpose of that calculation. I would think the fastest and easiest way to get a random word from the text file is to first read the entire file into a vector of std::strings, then the program will always know how may words there are. After that, it's a trivel calculation, generate a random number between 0 and the number of strings in the vector. No loops are needed for that. Read the file into a vector when the program first starts so that it doesn't have to read the file each time a random word is needed.
Of course I'm assuming the file is rather small, 1,000 (+/-) or fewer words. If the file is really huge then there are other alternatives that may be better than reading it all into memory at the same time.