#include #include #include "misc.h" void randomize (void) { struct timeval *tv = (struct timeval *) malloc(sizeof(struct timeval )); struct timezone *tz = (struct timezone *) malloc(sizeof(struct timezone)); gettimeofday(tv,tz); srand(tv->tv_usec); free(tv); free(tz); } int randint (int min, int max) { return (min + (int) ((max+1) * (rand() / (RAND_MAX+1.0)))); }