[TD-3783]<fix>: taosdemo for windows generates rand string invalid. (#5828)

This commit is contained in:
Shuduo Sang 2021-04-15 17:29:27 +08:00 committed by GitHub
parent 604c29b0b7
commit 42d0f5a3dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -1063,7 +1063,7 @@ static void rand_string(char *str, int size) {
//--size;
int n;
for (n = 0; n < size - 1; n++) {
int key = rand_tinyint() % (int)(sizeof(charset) - 1);
int key = abs(rand_tinyint()) % (int)(sizeof(charset) - 1);
str[n] = charset[key];
}
str[n] = 0;