C rand() Function
C arc4random() Function

These C functions return a random integer in the range 0 to RAND_MAX.

#include <stdlib.h>
#include <time.h>

time_t seconds;
time(&seconds);
srand((unsigned int) seconds);
or
srand ( time(NULL) );

int r = rand() % 10 + 1;
// r will be some number 1-10
or
int r = rand() % (high-low+1) + low;
// low is the low value and
// high is the high value


A simpler approach is to use
arc4Random()
Example:
int x = (int) (arc4random() % 100) + 1;
You must use:
#include <stdlib.h>