start에서 final까지의 범위안에 있는 난수 생성
----------------------------------------------
srand( time(NULL) );
{ rand() % (final - start + 1) } + start
----------------------------------------------
대략적인 분포가 일정한 형태의 큰난수????
----------------------------------------------
int GeneratorRandomNumber(int niStartNum, int niFinalNum)
{
int niRandNum = 0;
unsigned int nuiRandSeed = 0;
struct timeval curtime;
/*** srand( time(NULL) ); ***/
gettimeofday(&curtime);
nuiRandSeed = (unsigned int)( (curtime.tv_sec % 1000 * 1000000) + (curtime.tv_usec % 1000000) );
srand( nuiRandSeed );
niRandNum = (double)rand() / (double)(RAND_MAX) * (double)(niFinalNum - niStartNum) + niStartNum;
return niRandNum;
}
----------------------------------------------