[fpc-devel] I get duplicate GUIDs under Linux

Vinzent Höfler JeLlyFish.software at gmx.net
Sat May 31 06:19:11 CEST 2008

Jonas Maebe wrote:

> On 29 May 2008, at 13:26, Michael Van Canneyt wrote:
>> The default implementation on Linux uses a random() call to generate a
>> guid, combined with a timestamp, if I recall correctly.
> Note that random() will always return the same sequence if you don't 
> call randomize() once in the program.

Yes. But don't make the mistake to call it more than once.

I've seen code that calls it before each and every Random() call to make 
the number "more" random, thus obviously not considering the fact that 
consecutive calls to Randomize() are much less random that any generated 
Pseudo-Random-Sequence, because the output of Randomize() usually only 
depends on time - and last time I checked, time was still a pretty 
linear thing.

If Randomize() were "truly" and "more" random, one wouldn't need 
Random() after all, would one?


More information about the fpc-devel mailing list