Skip to content

Commit

Permalink
Revert "Improve fill_rand_string"
Browse files Browse the repository at this point in the history
This reverts commit abc484d.
  • Loading branch information
winswu committed Mar 17, 2024
1 parent abc484d commit 054ec4d
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions qtest.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,9 @@ static void fill_rand_string(char *buf, size_t buf_size)
while (len < MIN_RANDSTR_LEN)
len = rand() % buf_size;

uint64_t *randstr_buf_64 = malloc(len * sizeof(uint64_t));
randombytes((uint8_t *) randstr_buf_64, len * sizeof(uint64_t));
randombytes((uint8_t *) buf, len);
for (size_t n = 0; n < len; n++)
buf[n] = charset[randstr_buf_64[n] % (sizeof(charset) - 1)];

free(randstr_buf_64);
buf[n] = charset[buf[n] % (sizeof(charset) - 1)];
buf[len] = '\0';
}

Expand Down

0 comments on commit 054ec4d

Please sign in to comment.