#include #include void seed() { int i; /* * Seed the PRNG with a time value -- a fairly lame seed but * hopefully good enough for games. So then call it 20 times * (discarding its value), to spread this minor randomness through * the rest of the bits a little. */ srandom(time((time_t *)NULL)); for (i = 0; i < 20; i++) (void)random(); }