Thanks,
>KNC<
timeGetTime() has good resolution
--
http://www.pc-tools.net/
Windows, Linux & UNIX software
Whoa... why does the *clock* have any bearing on the *random number
generator*?
Are you doing this, in an attempt to get really random numbers?
for (;;)
{
srand(time(NULL));
printf("%d %d %d %d\n", rand(), rand(), rand(), rand());
}
If so, don't. Don't initialise the random number generator more than once
because, as you've seen, the numbers get *less* random (and start depending
on the clock).
To answer your question directly: there's no standard C or C++ way to do it,
but Windows has the GetTickCount() function with a resolution of 55ms or
finer.
--
Tim Robinson
http://www.themoebius.org.uk/
You should be seeding the random number generator ONCE when the
program starts up. After that, the clock isn't normally involved in
generating random numbers at all.
--
Later,
Jerry.
The Universe is a figment of its own imagination.
Win32 API function GetSystemTime() takes a pointer to SYSTEMTIME as a parameter.
One of the fields in this structure specifies current milliseconds.
Regards,
Michael
Demir
"Katharine Chartrand" <k...@usa.com> wrote in message
news:Jtl78.14275$Ri2.46976@rwcrnsc54...