srand 函数 求大佬告诉一下 一个链接也行
srand!!!!
程序代码:
/* srand example */
#include <stdio.h> /* printf, NULL */
#include <stdlib.h> /* srand, rand */
#include <time.h> /* time */
int main()
{
printf("First number: %d\n", rand() % 100);
srand(time(NULL));
printf("Random number: %d\n", rand() % 100);
srand(1);
printf("Again the first number: %d\n", rand() % 100);
return 0;
}