> gettimeofday(&tv, NULL); > rand = tv.tv_usec + tv.tv_sec; Someone trying to break your code could find out approximately when the number was generated, then they would have a much smaller search space to try.