关于随机数,有个地方不明白。
程序代码:#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main (void)
{
int i;
time_t t;
srand((unsigned int) time (&t));
for (i = 0; i < 10; i++)
{
printf ("%d\n", rand() % 10);
}
return 0;
}
怎么才能让产生的十个随机数没有重复的数字呢?只是0-9出现的位置不同。还有 srand((unsigned int) time (&t));这句话什么意思?注销了好像也没有什么影响。



