[fpc-devel] I get duplicate GUIDs under Linux
daniel.mantione at freepascal.org
Mon Jun 2 14:33:10 CEST 2008
Op Mon, 2 Jun 2008, schreef Michael Van Canneyt:
>>> People might want to start with a defined randseed to reproduce behaviour.
>> This implies createguid should not call randomize automatically either, it
>> prevents you having deterministic behaviour, especially in a program where
>> guids and normal use of the randomizer are combined.
> Creating GUIDs should never be deterministic.. ?
For debugging it can be usefull to have deterministic behaviour. But that
was not the point. The point was, that a call to randomize "disrupts" the
current state of the random generator. That means that if you use random
outside guid creation, creating a guid can have unintended side effects on
your random generation.
I agree it is nitpicking, but strictly speaking, it is a bad idea to
automatically initialize the random generator.
More information about the fpc-devel