FreeBASIC's PRNG #2

General FreeBASIC programming questions.
dodicat
Posts: 6365
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: FreeBASIC's PRNG #2

Postby dodicat » Sep 14, 2018 13:21

I also have downloaded PractRand.
I managed to compile with mingw, but I get loads of warnings.
Why is one version of mingw (gcc/g++ e.t.c.) not compatible with the previous??
Anyway I managed to get LibPractRand.a, but because it is c++ source (loads of classes), I have stalled.
The other way
Running Rng_test.exe -help I presume that it doesn't accept text files (binary or ascii).
I have tried a couple, but got an aborted report.
The solution is deltarho[]'s advice, to save any more fluffing around.
deltarho[1859]
Posts: 2345
Joined: Jan 02, 2017 0:34
Location: UK

Re: FreeBASIC's PRNG #2

Postby deltarho[1859] » Sep 14, 2018 13:29

I am up to my neck in an idea at the moment but the BASIC is not working.

Anyway.

@jj2007
Will check out your asm later.

@srvaldez

Yes, I knew about the birthday test - George Marsaglia was using it in his Diehard tests first published in 1995.

No, I do not run PractRand as O'Neill does. I gave jj2007 a link earlier to another thread where I detail how I use PractRand. Go here.

The first code block is the piping code I use to test PCG32II and the second code block shows what command line I use.
deltarho[1859]
Posts: 2345
Joined: Jan 02, 2017 0:34
Location: UK

Re: FreeBASIC's PRNG #2

Postby deltarho[1859] » Sep 14, 2018 13:35

dodicat wrote:The solution is deltarho[]'s advice, to save any more fluffing around.

If I go to a site where the source code is in some variant of C and we have to build the binaries then I am out a lot quicker than I went in. <Ha, ha>
srvaldez
Posts: 2331
Joined: Sep 25, 2005 21:54

Re: FreeBASIC's PRNG #2

Postby srvaldez » Sep 14, 2018 14:01

@deltarho[1859], would update PCG32II.bas posted here with your latest version?
deltarho[1859]
Posts: 2345
Joined: Jan 02, 2017 0:34
Location: UK

Re: FreeBASIC's PRNG #2

Postby deltarho[1859] » Sep 14, 2018 14:18

@srvaldez

You were using the latest version when you posted your att version except for a Constructor to automatically 'fire up' MyRandomize.

dodicat is using the latest version here.
srvaldez
Posts: 2331
Joined: Sep 25, 2005 21:54

Re: FreeBASIC's PRNG #2

Postby srvaldez » Sep 14, 2018 14:30

thanks :-)
paul doe
Posts: 1175
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: FreeBASIC's PRNG #2

Postby paul doe » Sep 14, 2018 14:33

deltarho[1859] wrote:I don't think that we have a problem with the Weyl sequence so I reckon that we don't need to use MSWS.validRandomSequence() for it.

The only way to know will be to leave it at 0, and then use other streams.
deltarho[1859] wrote:However, we do have a problem with the sequence/stream. I am not in favour of using MSWS.validRandomSequence() for this because '8ull shl 32 or 1' fails but passes MsWs.isValidSequence...

Houston, we have a problem. <smile>

Indeed. What I'll suggest, then, is this:

Test the streams at random( using isValidRandomSequence() ) up to a reasonable amount of numbers (that'll be your call as to what constitutes 'reasonable'). Use 0 for both the seed and the Weyl sequence (we're testing the stream here).
Should they succeed, record the stream used (you can ask the instance what it was by using the initialSequence() property), and set it aside.
Should they fail, record the stream used, and set it aside.

After a reasonable number of trials, we should have enough objective data to be able to identify commonalities for both, and perhaps we can arrive to an aswer as to why they succeed/fail. Who knows, perhaps we can even help Bernard create a masterpiece. We could be heroes! =D
paul doe
Posts: 1175
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: FreeBASIC's PRNG #2

Postby paul doe » Sep 14, 2018 14:48

deltarho[1859] wrote:I picked three at random and they worked. When I say worked I mean they got past the first PractRand hurdle - the failures were immediate. I cannot go through 25000 looking for a dead duck; assuming that there is one.

I have just tried 14,828,140,070,311,027,921 (CDC822D4C29FE4D1) which is not in seed.h. I have just gone past 128GB without a single anomaly. So, where did I get that number from? It is a bog standard 64-bit prime number. However, it satisfies Widynski's criteria so I am not proving anything.

Also, do make absolutely sure that you record which parameters you use in the tests that fail. Bernard asked me to report the failed parameters to him, so this info is very useful.

Would you consider talking to him directly? He left his email address at the paper, and you are far more capable of discussing things with him at the same level than me. He may be reading this thread as we speak, but he isn't familiar with FreeBasic. Should you require some C code to show to him, I'll gladly provide it for you.
deltarho[1859]
Posts: 2345
Joined: Jan 02, 2017 0:34
Location: UK

Re: FreeBASIC's PRNG #2

Postby deltarho[1859] » Sep 14, 2018 14:55

@paul doe

I am working on a very different approach where the sequence is no longer an issue. I need to spend some time testing it.

Your code from MsWs takes 138 lines. My Lite version is down to 52 lines. I am afraid that I have not taken any prisoners.

We have been knocking ourselves out with the sequence. I have changed Bernard's algorithm - a touch. Whether he likes what I have done remains to be seen. <smile>
paul doe
Posts: 1175
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: FreeBASIC's PRNG #2

Postby paul doe » Sep 14, 2018 15:02

Well, I'd love to see it! And if it works, you'll be my hero =D
paul doe
Posts: 1175
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: FreeBASIC's PRNG #2

Postby paul doe » Sep 14, 2018 15:08

This is the latest mail I got from him:

"I've tested those x, w, and s values with BigCrush and it passes.
Perhaps PractRand reveals an error for sparse s values with mostly zeros.
I suggest that you use seed.h to initialize the s values.
I suspect that these will pass Practrand"

Does PractRand states the reason for the failure? Can you extract the state from the generator (using the properties I provided for testing) so I can report back? He doesn't seem to be using PractRand...
deltarho[1859]
Posts: 2345
Joined: Jan 02, 2017 0:34
Location: UK

Re: FreeBASIC's PRNG #2

Postby deltarho[1859] » Sep 14, 2018 15:25

PractRand is lethal. Sebastian Vigna probably wishes it didn't exist since it has decimated most of the work he has done this last few years. Melissa O'Neill loves it - but then she would with PCG32 waltzing it's way to 16TB. <smile>

I am up to 32GB with the 'new' algorithm without any anomalies. validRandomSequence() and sValidSequence( ) are no longer required. What I have done is quite outrageous but it was staring us all in the face.
paul doe
Posts: 1175
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: FreeBASIC's PRNG #2

Postby paul doe » Sep 14, 2018 15:33

deltarho[1859] wrote:I am up to 32GB with the 'new' algorithm without any anomalies. validRandomSequence() and sValidSequence( ) are no longer required. What I have done is quite outrageous but it was staring us all in the face.

That's a very good thing. The least parameters to tweak, the better. Well, show us! Don't leave us dangling in this way! =D
deltarho[1859]
Posts: 2345
Joined: Jan 02, 2017 0:34
Location: UK

Re: FreeBASIC's PRNG #2

Postby deltarho[1859] » Sep 14, 2018 15:40

paul doe wrote:Well, show us! Don't leave us dangling in this way! =D

I don't want egg on my face.

128GB and no anomalies. I need a lie-down.
paul doe
Posts: 1175
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: FreeBASIC's PRNG #2

Postby paul doe » Sep 14, 2018 15:43

deltarho[1859] wrote:I don't want egg on my face.

Not sure if I understand what you mean.

Return to “General”

Who is online

Users browsing this forum: No registered users and 6 guests