Mail Archives: djgpp/1996/11/21/10:13:14
On Thu, 21 Nov 1996, Alexander V. Lukyanov wrote:
> I don't know if it is declared in a standard, but I think rand()
> should always return the same sequence if srand is not used.
> Of course, I can do srand(0), but usually I don't have to.
ANSI C says that `rand' will always generate the same sequence if `srand'
is not called before the first call to `rand'. It also specifies that
the above default sequence should be the same as if `srand' was called
with a seed value of 1. This means that the DJGPP implementation does
not conform to this last requirement, since it generates a sequence as if
`srand' was called with a seed of 0.
- Raw text -