[fpc-pascal] Random numbers

Graeme Geldenhuys graemeg.lists at gmail.com
Mon Mar 6 09:23:21 CET 2006


Why not use GUID's (or the other name is UUID's) and convert them to a
Integer from Hex.   You might need to make the GUID value smaller, or
part of the GUID (example the last block).

Regards,
  - Graeme -



On 3/3/06, Antal <antal at componente.net> wrote:
> >
> > 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
> And also generating a rand * getpid you can't really get good random
> numbers.
> I just made a withdrawal program on this idea, so I've got several
> repetitions, and upon executing a program again and agian I've got
> false random numbers, like: a*n; a*(n+1); a*(n+2).
> That's not a solution anyway.
>
> Maybe a bit shifting or some aritmetical function can help to
> obtain a more random "looking" number.
>
> I'm trying my next random number generation to filter it with the sin()
> function, so I can get a bit more entropy :)
> (I can't use atmospheric noise as some suggested)
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>



More information about the fpc-pascal mailing list