xkb_keycode_t keycode;
xkb_keysym_t keysym;
int i;
-
- srand((unsigned) time(NULL));
+ unsigned int seed = (unsigned int)time(NULL);
for (i = 0; i < BENCHMARK_ITERATIONS; i++) {
- keycode = (rand() % (255 - 9)) + 9;
+ keycode = (rand_r(&seed) % (255 - 9)) + 9;
if (keys[keycode]) {
xkb_state_update_key(state, keycode, XKB_KEY_UP);
keys[keycode] = 0;
size_t len;
char *str;
+ unsigned int seed = (unsigned int)time(NULL);
- srand((unsigned) time(NULL));
-
- len = rand() % 15;
+ len = rand_r(&seed) % 15;
str = malloc(len + 1);
assert(str);
for (size_t i = 0; i < len; i++)
- str[i] = random_chars[rand() % ARRAY_SIZE(random_chars)];
+ str[i] = random_chars[rand_r(&seed) % ARRAY_SIZE(random_chars)];
/* Don't always terminate it; should work without. */
- if (rand() % 2 == 0)
+ if (rand_r(&seed) % 2 == 0)
str[len] = '\0';
*str_out = str;
unsigned seed = (unsigned) clock();
srand(seed);
- N = 1 + rand() % 100000;
+ N = 1 + rand_r(&seed) % 100000;
arr = calloc(N, sizeof(*arr));
assert(arr);