rand isn't a very good random number generator, and
there are better ones (such as random()) on most systems.
It is, on the other hand, fast and easy to implement:
static unsigned int next = 1;
int rand( )
{
next = next * 1103515245 + 12345;
return ((next >>16) & 32767);
}