Random Word Generator? Plz Help
OK, so I would much appreciate anybodys help with this problem.
I have to come up with a program that will generate 1000 random words. These words don't have to be actual words in the dictionary, just a series of character. The words can be no longer than 9 characters. This is what I have so far....
Code:
#include <stdio.h>
int main() {
int i, j;
char temp[9];
for(i=0; i<1000; i++) {
int run=rand()%7 + 3;
for(j=0; j< run ; j++){
temp[j]= rand()%26+'a';
}
temp[run] = '\0';
printf("%s\n\n",temp);
}
system("PAUSE");
return
The first problem is that some of the words are more than 9 characters, and then the program only prints like 100 words not 1000. Any help or explanation would be great. Thanks in advanced.