# include<stdio.h>
# include<stdlib.h>
# include<time.h>
# define CLOCKS_PER_SEC 18.2
int main(){
int x,N;
int Num[100];
float starttime,endtime,gettime;
srand((unsigned)time(NULL));
start:
printf("\nHOW MANY DATA?\n");
scanf("%d",&N);
starttime = clock();
for(x=1;x<N;x++) {
int i=x;
Num[i]=rand();
printf("%d ",Num[i]);
}
endtime = clock();
gettime = (endtime-starttime)/CLOCKS_PER_SEC;
printf("\ntotal time :%f",gettime);
printf("\ntotal number is: %d\n",x);
goto start;
/*return 0;*/
}
为什么我得到的时间是随机的,循环相同的次数,
每次的时间都是不一样的