The goal is to provide Pseudo random number generators (Prng's) that are:
- a) thread safe within the limitation that a given thread will have its own independent random generator. This goal is achieved for FPC with my code.
- b) provide a compatibility mode with Delphi to be able to process Delphi generated statistical data in a verifiably identical way.This goal is also achieved with my code
- c) provide a compatibility option to use Data that relies on a particular Prng to be processed with FPC. This goal is achieved for MT19937(In C++11+ standards) and others just need code clean up.
The underlying rationale is that Prng's are often used in science and statistics to generate tests for conformity. These tests assume a defined Prng. A Defined, plugable, Prng is something that e.g. C++11 already has.
I am trying to provide the same feature for Free Pascal because it is important in the fields of statistics, computer science and science in general.
The average programmer does not care about all this. But scientists and statisticians care *a lot* about this.
Problem is most people on the forum do not know the difference between a Prng and truly random - in grumpy mode I would write j*ck sh*t
- they often do not even know that a Prng has a repeatable sequence on purpose. Worse, you will get silly comments... sigh... (not yours)
Which makes it hard to explain in layman computing terms. Trust me. It is important for the language.
If you find a flaw in the code your critique is appreciated within this context:
- the threads have their own, repeatable and afterwards reproducible, random if the seed is known, that is totally independent from the same random generator in other threads.
- the Prng's that pretend to implement a certain compatibility can be verified to provide that compatibility.
Note that Jonas Maebe's comment was geared towards another kind of thread safety: that where the
Random number generator is a singleton Prng per process and access to e.g. RandSeed is handled in a thread safe manner.
That's
NOT what my code is for. My code is about having
a singleton Prng on a per thread basis. I can already prove this approach works. And it makes more sense.
Probably Jonas can confirm this given this explanation. Jonas wrote the Mersenne Twister that FPC uses and he knows in depth about the theory behind it.