View Single Post
Old 02-26-2006, 07:23 PM   #7 (permalink)
kyoryu
Registered User
 
Join Date: Apr 2003
Posts: 34
kyoryu is on a distinguished road
This:

Code:
char randomVowel() {
    srand ((unsigned)time(0));
    char c;
    do {
        c = (rand() % ('a' - 'z' + 1)) + 'a';
    } while ((c != 'a') && (c != 'e') && (c != 'i') && (c != 'o') && (c != 'u'));
    
    return c;
}
is a BAD idea. It could theoretically hang forever if it doesn't just happen to hit a vowel. While it's practically unlikely to happen, it's not a good thing to put into code.
kyoryu is offline   Reply With Quote