Mail Archives: djgpp-workers/1998/11/16/10:43:34
> > so I figured I'd let libc randomize itself if srand() wasn't called
>
> Yes, but are we willing to break ANSI compliance because of what some
> people's unjustified (IMHO) expectations?
Sometimes, like when we flush after printf() even when we shouldn't.
When the spec says to do X and the users expect Y and there's no
advantage to X, I think Y is the right thing to do. Let the other
vendors answer the FAQs for a change.
People who really need a repeatable sequence of numbers from rand()
will need to use srand() anyway, to get different sets of repeatable
numbers. When debugging something that uses random numbers, the
program must select a random seed manually, and *print* it. If the
program displays bad behavior, it can be modified to always use
whatever seed it picked that time, so that that particular sequence
(and its consequences) can be debugged.
I see no advantage to arbitrarily picking one particular sequence as
the "default" random number sequence, especially since ANSI doesn't
define the random number generator, so cannot specify the sequence
itself.
The only advantage to doing it the ANSI way is that people learn what
will work correctly on other platforms.
Does anyone else have an opinion on this?
- Raw text -