[fpc-pascal] Random numbers

Antal antal at componente.net
Fri Mar 3 12:06:20 CET 2006


>
> 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)



More information about the fpc-pascal mailing list