Mail Archives: djgpp/1997/06/15/12:33:24
Ben N Shadwick (bshadwick AT juno DOT com) wrote:
: I don't believe you. What good does a bunch of functions that always
: return zero the first time you call them do (besides giving you four
: hundred ways to measure how fast your program is)? IMHO, they have many
: more applications when implemented the way the docs describe them - if
: you need to use it the "returns-zero-the-first-time" way, just set some
: variable equal to it and subtract its value to achieve the same effect.
: On the other hand, if you need a quick way to know the number of seconds
: (or clock ticks) since midnight, you have that too.
Making them behave as the docs say would render them useless (almost) for
timing purposes. Consider what would happen if your program was running at
midnight - mysterious bugs with the timing would occur. Spooky.
: Like Nate said, it only has a 1 second accuracy that way (not very
: desirable)
void randomise()
{
int a;
uclock();
a=time(0);
while (a==time(0));
srandom(uclock());
}
I think that should be pretty unpredictable as a starting point :)
--
George Foot <mert0407 AT sable DOT ox DOT ac DOT uk>
Merton College, Oxford
- Raw text -