There are different ways to generate decent random integers. Sadly, there isn't an easy way defined by POSIX so we'll have to make a wrapper. Some sources of randomness include:
some systems provide uint32_t arc4random(void) which works well
all Unix systems have /dev/random and /dev/urandom (this wastes a file descriptor)
we could import something like mt19937 and seed it using something more heavy weight like /dev/urandom
There are different ways to generate decent random integers. Sadly, there isn't an easy way defined by POSIX so we'll have to make a wrapper. Some sources of randomness include:
uint32_t arc4random(void)
which works well/dev/random
and/dev/urandom
(this wastes a file descriptor)/dev/urandom