rand_r
extern int rand_r(unsigned int *seed);
uint32_t value = rand_r(&seed) % (sizeof(padchar) - 1);