#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<sys/types.h>
#include<sys/timeb.h>
随机程序如下:
void main(void)
{
int i,k;
double j
;
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);
i=rand()%100;
j=i/1000.0;
printf("%f\n",j);
}
也就是说这样可以是吧
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<sys/types.h>
#include<sys/timeb.h>
void main(void)
{
int i,k;
double j
;
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);
i=rand()%100;
j=i/1000.0;
这里接其它C程序;
}