lemire / testingRNG

Testing common random-number generators (RNG)
Apache License 2.0
172 stars 22 forks source link

Adjust use of splitmix64 when seeding other RNGs #25

Closed rdebath closed 1 year ago

rdebath commented 1 year ago

WRT: Issue https://github.com/lemire/testingRNG/issues/24

I have currently got two methods of updating the use of splitmix64, your state recalculation method (or "stateless") and the more usual method of providing a pointer to space for the RNG state. The first uses an additional argument to split the seed and the number of rounds to skip, the second uses the provided space to carry state between invocations.

I prefer the more usual splitmix64_r style, however, this would involve adding some temp variables to avoid C "undefined behavior" for several of the uses. Would you like me to do this or leave the changes as they are?

Also: I've merged the multiple copies of splitmix64 into splitmix64_r which is then called by different wrappers.

Also: As an aside I had to downgrade the build environment to Debian Stretch as later versions of Debian are abort()ing due to double free errors when I start Practrand.

lemire commented 1 year ago

The changes look good to me as they are.

rdebath commented 1 year ago

Looking consistent, though testwyhash-H and testwyrand-H are run by the script and crash because they don't exist.

testaesctr                [Low16/64]Gap-16:A                R=  +4.6  p =  1.9e-3   unusual
testaesdragontamer        [Low1/64]FPF-14+6/16:cross        R=  -2.3  p =1-4.8e-4   unusual
testmersennetwister       [Low16/64]BRank(12):12K(1)        R= +3016  p~=  6.7e-909   FAIL !!!!!!!
testmitchellmoore         [Low1/64]BRank(12):256(1)         R= +51.9  p~=  1.1e-16    FAIL !
testpcg32               length= 512 gigabytes (2^39 bytes), time= 2510 seconds
testpcg64-H               DC6-9x1Bytes-1                    R=  +5.7  p =  7.7e-3   unusual
testpcg64                 [Low4/64]DC6-9x1Bytes-1           R=  -4.6  p =1-2.9e-3   unusual
testsplitmix64-H          [Low4/64]DC6-9x1Bytes-1           R=  +7.4  p =  4.7e-4   mildly suspicious
testsplitmix64            BCFN(2+0,13-0,T)                  R=  +8.4  p =  4.8e-4   unusual
testv8xorshift128plus-H   BCFN(2+1,13-0,T)                  R= +24.0  p =  2.3e-12    FAIL
testv8xorshift128plus     [Low4/64]BRank(12):768(1)         R= +1272  p~=  5.4e-384   FAIL !!!!!!!
testwidynski              [Low4/64]DC6-9x1Bytes-1           R=  +5.5  p =  5.7e-3   unusual
testwyhash              length= 512 gigabytes (2^39 bytes), time= 2475 seconds
testwyrand                [Low1/64]BCFN(2+1,13-3,T)         R=  +8.8  p =  5.8e-4   unusual
testxoroshiro128plus-H  length= 512 gigabytes (2^39 bytes), time= 2415 seconds
testxoroshiro128plus      [Low4/64]BRank(12):768(1)         R= +1272  p~=  5.4e-384   FAIL !!!!!!!
testxorshift-k4           BRank(12):256(4)                  R= +5300  p~=  1e-2819    FAIL !!!!!!!!
testxorshift-k5           [Low4/64]BRank(12):768(1)         R=+583.3  p~=  1.2e-176   FAIL !!!!!!
testxorshift1024plus-H  length= 512 gigabytes (2^39 bytes), time= 2507 seconds
testxorshift1024plus      [Low1/64]BRank(12):1536(1)        R=+10916  p~=  3e-3287    FAIL !!!!!!!!
testxorshift1024star-H    [Low16/64]DC6-9x1Bytes-1          R=  -5.3  p =1-1.3e-3   unusual
testxorshift1024star      [Low4/64]BRank(12):1536(1)        R= +2650  p~=  9.8e-799   FAIL !!!!!!!
testxorshift128plus-H     BCFN(2+1,13-0,T)                  R= +24.6  p =  1.1e-12    FAIL
testxorshift128plus       [Low4/64]BRank(12):768(1)         R= +1272  p~=  5.4e-384   FAIL !!!!!!!
testxorshift32            BCFN(2+0,13-2,T)                  R=+179.4  p =  2.8e-91    FAIL !!!!!
lemire commented 1 year ago

Where do you find testwyhash-H?

rdebath commented 1 year ago

End of this line: https://github.com/lemire/testingRNG/blob/bfd776ba13b837bc1680de08e5de389a7f44f10d/practrand/runtests.sh#L10

lemire commented 1 year ago

That should be testwyhash -H and not testwyhash-H. It should call testwyhash and pass it the -H flag. The testwyhash binary should exist.

rdebath commented 1 year ago

Oh, sorry, I meant that the -H option doesn't exist in that binary. The two binaries run fine without the -H but they don't have the -H option that the second call tries to use and segfault when it's tried (On Debian Stretch).

Looking more closely they are both seem to return 64bit values so I suppose they should support that flag.

lemire commented 1 year ago

Merging.