随机数的生成的三种方法.
// 1.
struct timeval tv;
struct timezone tz;
gettimeofday(&tv, &tz);
unsigned seed = (tv.tv_sec * 1000 + tv.tv_usec / 1000) & RAND_MAX;
srandom(seed);
int randomNum = random() % 3;
// 2.
srandom(time(nil));
NSLog(@"%d",random()%100);
randomNum = random() % 3;
// 3.
time_t t;
srand((unsigned)time(&t));
int randomNum = 10+rand()%30;