I joined the FreeBASIC forum in January 2017. In February, I ported CryptoRND from PowerBASIC. I then learnt of thread pooling and CryptoRNDII was born. I then did some work with Mersenne Twister. CMWC4096 was ported from PowerBASIC. In June 2017, I got involved with PCG32 before which things had been quiet on the PRNG front.
Sebastiano Vigna knocked out some new generators to replace his ailing earlier versions. Bernard Widynski came up with MsWs and then Squares; in varying flavours. Along comes SFC and then RomuTrio.
I am reminded of the joke about London buses. We wait for nearly an hour without seeing one, and then three turn up.
Back in January 2017, I did not foresee the PRNG flurry on the horizon. It happens in science. Someone comes up with a new idea in Quantum Mechanics. Before we know it, half the world's scientists are climbing on the bandwagon.
So, we end up with my PRNG implementations peppered all over the forum.
Yours truly wrote:and return either an integer random number or a random value in the range [0,1) and no more.
fxm wrote:In 'fbmath.bi', 5 other PRNGs are defined (each producing either a 'ulong' or a 'double').
To my mind, that is woefully inadequate, and I have no intention of getting involved with fbmath.bi.
Paul Doe found Bernard Widynski's Middle-Square Weyl Sequence RNG. What we did not know was that it was version 3 coming out in My 2020. Version 1 came out in April 2017 and version 2 came out in July 2019.
Guess what? Version 4 was published a couple of weeks ago, March 22, 2022. The most interesting aspect is the inclusion of a 64-bit output generator. Widynski wrote: “If 32-bit precision is adequate (which is most often the case) msws64 may be the fastest RNG for producing floating-point numbers.” I have always thought that a 53-bit granularity double would not interest many. However, with RomTrio's 64-bit output generator I came up with GetDuo(x,y) which returns two 32-bit granularity doubles from the 64-bit output. GetMono was invented to return one 32-bit granularity double and caches the second. The second one is taken from the cache, and we then generate two more 32-bit granularity doubles and so on.
I am rewriting MsWs to make use of the 64-bit generator. I am scrapping fixed seeding and have introduced an initial state snapshot and a snapshot facility to be implemented at any time thereafter. Fourteen procedures are implemented so far and I will probably make the new MsWs my default generator, forsaking all the other generators that I have looked at. Performance wise it ranks the highest with many procedures and at the top end with the others. So, we will have a good all-rounder for both 32-bit mode and 64-bit mode and replace PCG32II as the best all-rounder.
I really wish that fbmath.bi had never seen the light of day. coderJeff had good intentions, but I disliked the look of it from the start.
The new MsWs will cover most people's needs. We could use it to generate a 32-bit [0,1) and nothing else and have very few procedures compiled. It has a 32-bit output engine and a 64-bit output engine. The source code is at just over 230 lines currently, not much more than PCG32II, but is very intimidating. It will be published with a Help file as with PCG32II.
It is worth noting that once we get to a certain throughput speed a faster throughput will have little bearing on our applications. We could use a faster generator for some procedures, but when we are done, we will probably wonder why we bothered. The new MsWs will do for most of us, if not all. I like Widynski's MsWs maths – he is thorough, and that cannot be said for some of the latest generators. Even PCG32 has been criticized for its lack of rigour, although no one has found it wanting in practice.
There will be no need to search the forum for a PRNG.
and we are done.
So, when will MsWsII be available? I don't know – I am pretty thorough as well.