为什么我的连续随机数生成出来都一样?
下面是我网上拷贝的程序,自己做了一些修改,运行后发现x,y数值循环随机生成的都一样。请高手帮忙改下!!不慎感激…………for(i=0;i<num;i++) /*随即生成O点坐标*/
{
unsigned int seedVal;
struct timeb timeBuf;
ftime(&timeBuf);
seedVal=((((unsigned int)timeBuf.time&0xFFFF)+
(unsigned int)timeBuf.millitm)^
(unsigned int)timeBuf.millitm);
srand((unsigned int)seedVal);
x1=rand()%500;
y1=rand()%500;
x=x1/1000.0;
y=y1/1000.0;
printf("x=%lf,y=%lf\n",x,y);