引用:
作者: pedrowong
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
int a,b;
srand( (unsigned)time( NULL ) );
for(a=0;a<=7;a++)
{
b=rand()%42+1;
if(b<=42&&b>=0)
printf("%d\n",b);
}
system("pause");
return 0;
}
|
原來隨機種子要這樣打~~可是為什麼大大執行出來的答案有8個??