[fpc-pascal] Better random numbers ?
Jonas Maebe
jonas.maebe at elis.ugent.be
Tue Feb 28 12:53:32 CET 2006
On 27 feb 2006, at 00:15, A.J. Venter wrote:
>> Randomize;
>> RandSeed := RandSeed * getpid;
> This worked, cut the initial generation time from about 30 seconds
> down to
> under 1, of course right now it's NOT platform independent at all
> so I will
> need to enhance it but I like the direction of your thinking,
> combining
> randseed with some virtually guaranteed unique value solves the
> problem.
It's not just that, but randseed is not a threadvar. This means that
all your threads use the same randseed variable, so if two threads
call "random" at the same time they will still get the same "random"
number.
Jonas
More information about the fpc-pascal
mailing list