Here is how you use the random number generator from the standard C library.
Seed the generator. Do this at the begining of your program.
srand(time(NULL));
Then you can call rand() which will return an integer between 0 and RAND_MAX. (RAND_MAX is usually 32,767) To get a random number between 0 and X just take the mod of X+1.
i.e. to get a random number between 0 and 99:
num = rand() % 100;
rand() does not get a random number from the computer crystal. rand() takes a seed number and produces a pseudo-random number. The next time rand() is called it uses the previously generated number as a seed. At the begining of the program you seed the generator with the time, because if you seeded with a constant number like 1, you would get the same sequence of numbers every time. The time will be different every time you run the program, so your sequence will be different.