well, of the generator. you should also be cautious with utilizations like these:
rand()%40000, because RAND_MAX is often defined as 65535, so in this case you'll get the numbers between 0 and 25535 twice as often as the ones above this interval.