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

Reimar Grabowski reimgrab at web.de
Thu Dec 8 20:28:37 CET 2011


On Thu, 08 Dec 2011 12:51:18 -0500
waldo kitty <wkitty42 at windstream.net> wrote:

> i wouldn't say specifically place it in the maths unit but what's wrong with 
> having both available via a "fastrandom" boolean parameter that is passed? if 
> the parameter is not passed, it is defaulted to TRUE... if one wants the MT 
> random, then they send FALSE in this parameter... seems simple enough... i think ;)

Looks like you have it reversed. The parameter should default to FALSE to not break existing code relying on FPCs random function and if you need the fast one you have to call it with TRUE. As the fast random function then has to be called with random(x, true) it will not help Graeme in any way as he wants the fast one to be the default to bring performance to the same level as Delphi and stay compatible, this means calling random without a boolean parameter.
But breaking existing code for such a "feature" is IMHO the wrong thing to do.

just my 2 cents
R.



More information about the fpc-pascal mailing list