Re: [fpc-devel] Random thread-safe

2016-01-29 Thread Jonas Maebe
Jonas Maebe wrote on Fri, 29 Jan 2016: Ondrej Pokorny wrote on Fri, 29 Jan 2016: On 28.01.2016 13:30, Jonas Maebe wrote: Mersenne twister Should I be worried about the GPL-2 license of the Mersenne Twister that is cited in system.inc? It's LGPL, not GPL. There is however the problem

Re: [fpc-devel] Random thread-safe

2016-01-29 Thread Ondrej Pokorny
On 29.01.2016 14:07, Jonas Maebe wrote: It's LGPL, not GPL. Thanks, I again missed it. I should read more carefully. Everything is clear now! Ondrej ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailm

Re: [fpc-devel] Random thread-safe

2016-01-29 Thread Ondrej Pokorny
On 28.01.2016 13:30, Jonas Maebe wrote: Mersenne twister Should I be worried about the GPL-2 license of the Mersenne Twister that is cited in system.inc? I don't write GPL-software. Ondrej ___ fpc-devel maillist - fpc-devel@lists.freepascal.org h

Re: [fpc-devel] Random thread-safe

2016-01-29 Thread Jonas Maebe
Ondrej Pokorny wrote on Fri, 29 Jan 2016: On 28.01.2016 13:30, Jonas Maebe wrote: Mersenne twister Should I be worried about the GPL-2 license of the Mersenne Twister that is cited in system.inc? It's LGPL, not GPL. Jonas ___ fpc-devel mailli

Re: [fpc-devel] Random thread-safe

2016-01-28 Thread Mark Morgan Lloyd
Jonas Maebe wrote: Mark Morgan Lloyd wrote: Could I ask for clarification of this please. Are you saying that Random() will crash if called simultaneously by multiple threads, or that it will return suboptimal results? It's undefined. The current implementation won't crash, but the results wi

Re: [fpc-devel] Random thread-safe

2016-01-28 Thread Mark Morgan Lloyd
Jonas Maebe wrote: Also: the entire state of the random number generator consists of regular global variables, so it is not safe to use it from multiple threads in parallel. Would it make sense to you to make random thread-safe? E.g. with the use of "threadvar" instead of "var" for the globa

Re: [fpc-devel] Random thread-safe

2016-01-28 Thread Sven Barth
Am 28.01.2016 16:39 schrieb "tha...@thaddy.com" : > 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) That's not the usecas

Re: [fpc-devel] Random thread-safe

2016-01-28 Thread Jonas Maebe
Mark Morgan Lloyd wrote: Could I ask for clarification of this please. Are you saying that Random() will crash if called simultaneously by multiple threads, or that it will return suboptimal results? It's undefined. The current implementation won't crash, but the results will indeed be subopti

Re: [fpc-devel] Random thread-safe

2016-01-28 Thread Jonas Maebe
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 Which means software should take advantage of hardware when possib

Re: [fpc-devel] Random thread-safe

2016-01-28 Thread tha...@thaddy.com
The point is partially more or less at the end of the link I included. The reference to the Rdrand Which means software should take advantage of hardware when possible. But it is about more than that. An

Re: [fpc-devel] Random thread-safe

2016-01-28 Thread Michael Van Canneyt
On Thu, 28 Jan 2016, Jonas Maebe wrote: thaddy wrote on Thu, 28 Jan 2016: Then wouldn't it be possible to make PRNG's plugable. The Mersenne twister is still good as it is but definitely not suitable for every and any case. Marsialigla's might be a better choice nowadays. And the seeding

Re: [fpc-devel] Random thread-safe

2016-01-28 Thread Jonas Maebe
thaddy wrote on Thu, 28 Jan 2016: Then wouldn't it be possible to make PRNG's plugable. The Mersenne twister is still good as it is but definitely not suitable for every and any case. Marsialigla's might be a better choice nowadays. And the seeding can nowadays often been done from reading

Re: [fpc-devel] Random thread-safe

2016-01-28 Thread Anthony Walter
Make it use lazy instantiation please. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Re: [fpc-devel] Random thread-safe

2016-01-28 Thread tha...@thaddy.com
Then wouldn't it be possible to make PRNG's plugable. The Mersenne twister is still good as it is but definitely not suitable for every and any case. Marsialigla's might be a better choice nowadays. And the seeding can nowadays often been done from reading hardware random, like on the Raspberry

[fpc-devel] Random thread-safe

2016-01-28 Thread Ondrej Pokorny
Regarding: http://bugs.freepascal.org/view.php?id=29526 (because I cannot answer on closed issues). >> Also: the entire state of the random number generator consists of regular global variables, so it is not safe to use it from multiple threads in parallel. Would it make sense to you to make

Re: [fpc-devel] Random thread-safe

2016-01-28 Thread Jonas Maebe
Ondrej Pokorny wrote on Thu, 28 Jan 2016: Regarding: http://bugs.freepascal.org/view.php?id=29526 (because I cannot answer on closed issues). Also: the entire state of the random number generator consists of regular global variables, so it is not safe to use it from multiple threads in p