|
From: Ioannis V. <iv...@em...> - 2003-06-18 23:58:45
|
> -----Original Message----- > From: dev...@li...=20 > [mailto:dev...@li...] On Behalf=20 > Of Sudhir K KRISHNAWARRIER > Sent: Thursday, June 19, 2003 1:10 AM > To: dev...@li... > Subject: RE: [Dev-C++] rand() >=20 > May be it is a little better to use the time in=20 > micro/milliseconds in some form as the seed instead of time=20 > (NULL) which returns seconds. This will make sure that two=20 > instances of the program started almost the same time will=20 > not get the same random number sequence. In SVR4/BSD,=20 > gettimeofday will do the trick but not sure what is the POSIX=20 > way of getting microseconds. time() is not returning seconds it is returning time_t which can be = whatever the implementation wants. Two subsequent calls of time() cannot return = the same value since it represents the calendar time (day. month, year, = hour, minutes, seconds...). Ioannis Vranos =20 * Programming pages: http://www.noicys.freeurl.com * Alternative URL 1: http://run.to/noicys * Alternative URL 2: http://www.noicys.cjb.net |