[fpc-devel] Random thread-safe

Jonas Maebe jonas.maebe at elis.ugent.be
Thu Jan 28 16:51:44 CET 2016


thaddy wrote on Thu, 28 Jan 2016:

> The point is partially more or less at the end of the link I  
> included. The reference to the Rdrand  
> <http://software.intel.com/en-us/articles/user-manual-for-the-rdrand-library-linux-version>
> Which means software should take advantage of hardware when possible.
> But it is about more than that.
>
> And with due regards: the choice of the Mersenne twister over a  
> Delphi equivalent one was made by about the same arguments I have  
> now: it was better.

There are different kinds of "better". E.g. the current one is the  
same on all platforms, which means that by setting a particular  
randseed, you can get the same sequence on all platforms (e.g. for  
simulations). If you start using platform-specific functionality, that  
is no longer the case. Depending on the implementation, they may not  
even support getting the same sequence of numbers again on the same  
platform by setting randseed to a particular value, which is a basic  
feature of the TP/Delphi PRNG that many programs depend on.

> PRNG's are more and more important. They deserve extra effort even  
> if it is not used for the compiler itself.
> (It may very well be: when all software needs signing on all major  
> platforms, which is tomorrow in IT standards)

If you're using a PRNG for security purposes, you're doing security  
wrong. RNGs suitable for security sensitive applications belong in  
their own unit or set of units, along with the encryption algorithms.


Jonas



More information about the fpc-devel mailing list