How can I generate a random number?

Description

How can I generate a random number?
Call srand(time(NULL)) at the beginning of your program, and then use rand()%limit to obtain a pseudo-random number between 0 and limit-1.