状態の大きさが64ビットの高速で質の高い疑似乱数 SplitMix64 があります。
SplitMix64 https://github.com/svaarala/duktape/blob/master/misc/splitmix64.c以下は SplitMix64 をマルチスレッド用に書き替え、逆順とジャンプを加えたものです。
多くのコンパイラでコンパイル可能です。
これは状態の大きさが64ビットしかないので、周期が短いという欠点があります。
そこで SplitMix64 のコメントにはマルチスレッドでは xoroshiro128+ を、
大規模な計算では xorshift1024* を使うように勧めています。
しかし、この2つの疑似乱数は、
testingRNG : testing popular random-number generators(https://github.com/lemire/testingRNG)
で
検定に失敗すると書かれています。
SplitMix64 を rdrand と同じように testU01 で検定しました。
第10世代の Core i5-10500T+Windows11 23H2 で約20時間かかりました。
type , c, test , p-value SncRand rawhi Seed(1), B, RandomWalk1 C(L=10000,r=0), 0.9994 SncRand rawhi Seed(2), B, Passed , - SncRand rawhi Seed(3), B, WeightDistrib,r=0 , 7.9e-5 SncRand rawhi Seed(4), B, Passed , - SncRand rawhi Seed(5), B, Passed , - SncRand rawhi Seed(6), B, Gap,r=20 , 0.9991 - , B, RandomWalk1 C(L=10000,r=0), 7.1e-4 SncRand rawlo Seed(1), B, Passed , - SncRand rawlo Seed(2), B, Passed , - SncRand rawlo Seed(3), B, Passed , - SncRand rawlo Seed(4), B, Passed , - SncRand rawlo Seed(5), B, AppearanceSpacings,r=27 , 9.2e-4 SncRand rawlo Seed(6), B, ClosePairs mNP,t=16 , 5.9e-4 SncRand revhi Seed(1), B, Passed , - SncRand revhi Seed(2), B, ClosePairs mNP2S,t=5 , 1-1.4e-5 SncRand revhi Seed(3), B, MaxOft,t=32 , 0.9995 - , B, AutoCor,d=3,r=27 , 5.6e-4 SncRand revhi Seed(4), B, Passed , - SncRand revhi Seed(5), B, Passed , - SncRand revhi Seed(6), B, Passed , - SncRand revlo Seed(1), B, Passed , - SncRand revlo Seed(2), B, Passed , - SncRand revlo Seed(3), B, Passed , - SncRand revlo Seed(4), B, Passed , - SncRand revlo Seed(5), B, Passed , - SncRand revlo Seed(6), B, Passed , - SncRand swphi Seed(1), B, Passed , - SncRand swphi Seed(2), B, Passed , - SncRand swphi Seed(3), B, Passed , - SncRand swphi Seed(4), B, BirthdaySpacings,t=16 , 0.9995 SncRand swphi Seed(5), B, Passed , - SncRand swphi Seed(6), B, Passed , - SncRand swplo Seed(1), B, MaxOft AD,t=16 , 0.9993 SncRand swplo Seed(2), B, Passed , - SncRand swplo Seed(3), B, Passed , - SncRand swplo Seed(4), B, Passed , - SncRand swplo Seed(5), B, Passed , - SncRand swplo Seed(6), B, Passed , -このように rdrand とほぼ同じ品質であることがわかります。
SplitMix64は統計的性質が優れています。
-te 0 を te0、-te 1 を te1、-te 10 を te10、-tf 1 を tf1、-tf 2 を te2 と表します。
[te0, te1, te10]、[tf1, tf2] の組合せ6つの全てを種1で検定しました。
te0 では 32TB、te1, te10 では8TB まで調べました。
te1 tf2 の場合、
RNG_test stdin64 -tlmin 1GB -te 1 -tf 2 -tlmax 8TB -multithreaded SncRand te1 tf2 Seed(1) RNG_test using PractRand version 0.96 RNG = RNG_stdin64, seed = unknown test set = expanded, folding = extra ... length= 4 gigabytes (2^32 bytes), time= 118 seconds Test Name Raw Processed Evaluation [Low4/16]NS3[0:hw:both] R= +4.2 p~= 1.1e-5 unusual [Low4/32]NS3[1:pd:both] R= +4.2 p~= 1.6e-5 unusual ... length= 8 gigabytes (2^33 bytes), time= 227 seconds Test Name Raw Processed Evaluation [Low4/16]NS3[0:hw:both] R= +4.1 p~= 2.3e-5 unusual ... length= 8 terabytes (2^43 bytes), time= 157693 seconds no anomalies in 3432 test result(s)
となりました。それ以外の5つに異常はありませんでした。
te1 tf2 の場合でも種2では異常はありませんでした。
PractRand ver0.96で QncRand を種を1~40にして 1GB, 2GB, 4GB の3つの長さで、
異常のあったものを表示します。
この120回分を1つのテストとします。
1つのテストを(te0,te1)と(tf1,tf2)の4個の組み合わせをテストして合計480回調べました。
SncRand te0 tf1 Seed(5) 1GB [Low1/64]DC6-9x1Bytes-1 p=1-3.6e-3 unusual SncRand te0 tf1 Seed(7) 4GB [Low16/64]FPF/16:cross p=1-4.8e-4 unusual SncRand te0 tf1 Seed(10) 2GB [Low4/64]DC6-9x1Bytes-1 p=2.9e-3 unusual SncRand te0 tf1 Seed(11) 1GB [Low16/64]FPF/16:cross p=2.0e-5 mildly suspicious SncRand te0 tf1 Seed(16) 2GB DC6-9x1Bytes-1 p=3.1e-3 unusual SncRand te0 tf1 Seed(16) 2GB [Low1/64]mod3n(5):(2,9-3) p=1-5.1e-5 unusual SncRand te0 tf1 Seed(27) 1GB [Low4/64]DC6-9x1Bytes-1 p=1-1.3e-3 unusual
SncRand te0 tf2 Seed(13) 1GB [Low4/16]BCFN(2+0,13-2U) p=2.7e-4 unusual SncRand te0 tf2 Seed(16) 2GB [Low1/64]mod3n(5):(2,9-3) p=1-5.1e-5 unusual SncRand te0 tf2 Seed(19) 4GB [Low8/32]FPF/16:all p=1-1.4e-4 unusual SncRand te0 tf2 Seed(26) 4GB [Low1/32]DC6-9x1Bytes-1 p=5.6e-4 unusual SncRand te0 tf2 Seed(27) 1GB [Low4/64]DC6-9x1Bytes-1 p=1-1.3e-3 unusual SncRand te0 tf2 Seed(27) 4GB [Low4/16]BCFN(2+1,13-1U) p=1-5.3e-5 unusual
SncRand te1 tf1 Seed(7) 1GB [Low4/64]DC7-5x4Bytes-1:indep p=1-1e-4 unusual SncRand te1 tf1 Seed(10) 4GB [C8]DC6-9x1Bytes-1 p=1-3.1e-4 unusual SncRand te1 tf1 Seed(25) 1GB [Low1/64]NS3[6:hw:both] p=1.1e-5 unusual SncRand te1 tf1 Seed(27) 1GB [Low4/64]NS3[6:hw:both] p=1.4e-5 unusual SncRand te1 tf1 Seed(28) 1GB [Low1/64]NS3[2:pd:both] p=1-1.5e-5 mildly suspicious SncRand te1 tf1 Seed(30) 1GB [Low16/64]NS3[3:pd:both] p=1-1.5e-4 unusual SncRand te1 tf1 Seed(35) 1GB [Low4/64]DC7-5x4Bytes-1:both p=1-2.4e-4 unusual SncRand te1 tf1 Seed(35) 4GB [Low4/64]DC7-9x1Bytes-1:indep p=1-2e-5 unusual SncRand te1 tf1 Seed(37) 1GB [Low1/64]BCFN(0+0,13-4U) p=3.3e-5 unusual
SncRand te1 tf2 Seed(1) 4GB [Low4/16]NS3[0:hw:both] p=1.1e-5 unusual SncRand te1 tf2 Seed(1) 4GB [Low4/32]NS3[1:pd:both] p=1.6e-5 unusual SncRand te1 tf2 Seed(3) 1GB [Low1/16][C8]BCFN(2+1,13-6U) p=4.1e-5 unusual SncRand te1 tf2 Seed(4) 2GB [Low1/16]BCFN(0+0,13-2U) p=4.1e-5 unusual SncRand te1 tf2 Seed(11) 1GB [Low4/32][C8]mod3n(5):(1,9-4) p=1.0e-5 unusual SncRand te1 tf2 Seed(25) 1GB [Low1/64]NS3[6:hw:both] p=1.1e-5 unusual SncRand te1 tf2 Seed(27) 1GB [Low4/64]NS3[6:hw:both] p=1.4e-5 unusual SncRand te1 tf2 Seed(28) 1GB [Low1/64]NS3[2:pd:both] p=1-1.5e-5 unusual SncRand te1 tf2 Seed(35) 4GB [Low4/64]DC7-9x1Bytes-1:indep p=1-2e-5 unusual SncRand te1 tf2 Seed(37) 1GB [Low1/64]BCFN(0+0,13-4U) p=3.3e-5 unusual
gcc, clang, vc2002 .. vc2026 でコンパイル可能です。
define.h, bincode.h はこちら
bincode.h は Visual C++2002 と Visual C++ 2003 以外では必要ありません。
多くのコンパイラでコンパイル可能です。
gcc, clang, VC++2013 .. VC++2026 でコンパイル可能です。
多くのコンパイラでコンパイル可能です。
gcc, clang, vc2017 .. vc2026 でコンパイル可能です。
多くのコンパイラでコンパイル可能です。
[前:rdrandをtestU01とPractRand ver0.96で検定する] [ExRand目次] [次:SplitMix64とXorshiftを組み合わせる(小型)]