English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

1 answers

In what language?

Here's a code snip in C for this... (I haven't compiled this so there may be some slight syntax errors.)

char myArray[200];
time_t t;

srand((unsigned) time(&t));

// NOTE: There are 19 letters in b..t, so a random number
// from 0 to 18 added to a constant 98 (decimal for the letter b)
// will do the trick
for (int x=0; x<200; x++) {
myArray[x]= (int)(rand() % 18)+98;
}

2007-02-27 03:09:30 · answer #1 · answered by BigRez 6 · 0 0

fedest.com, questions and answers