[fpc-pascal] Why is Random(255) some 529x slower compared to Delphi 7?

Felipe Monteiro de Carvalho felipemonteiro.carvalho at gmail.com
Thu Dec 8 08:25:27 CET 2011


On Thu, Dec 8, 2011 at 7:27 AM, Jürgen Hestermann
<juergen.hestermann at gmx.de> wrote:
> Fully agree. Especially, because ex Delphi (and ex Turbo Pascal) users would
> expect it like that. And most of them (coming from Delphi/TP) believe that
> the randomness is not very reliable. They mainly don't even know (like me)
> that the FPC random() is much more sophisticated.

Based on what they expect that? For sure not based on reading the
Delphi documentation about Random:

http://docs.embarcadero.com/products/rad_studio/delphiAndcpp2009/HelpUpdate2/EN/html/delphivclwin32/System_Random.html

There is no mention of it being fast and also not about it being weak
statistically, so those are undocumented behavior. But it is written:

"Note:  Because the implementation of the Random function may change
between compiler versions, we do not recommend using Random for
encryption or other purposes that require reproducible sequences of
pseudo-random numbers."

So are we supporting usage of Random in Delphi which depends on
implementation details even while the documentation never said they
were guaranteed but instead explicitly says it can change?

And what if it changes in the future to being slow and statistically
strong, we change again too?

And what about people using FPC only and depending on our Random being
statistically strong, they are less important then theorical Delphi
migrants?

-- 
Felipe Monteiro de Carvalho



More information about the fpc-pascal mailing list