[前:SplitMix64について]   [ExRand目次]   [次:SplitMix64とXorshiftを組み合わせる(大型)]

[ANC]SplitMix64とXorshiftを組み合わせる(小型)

目次

[ANC]SplitMix64とXorshiftを組み合わせる(小型)

SplitMix64 は周期が2⁶⁴と短くなっています。
そこで SplitMix64 と Xorshift を組み合わせた anc.h を開発しました。
これはメモリ使用量と速度をできるだけ増やさずに、周期を2²⁵⁶-2⁶⁴と長くしたものです。

多くのコンパイラでコンパイル可能です。

AncRandをtestU01で検定する

QnxRand は AncRand をより一般化した疑似乱数です。
3A は QnxRand を AncRand と同じにするパラメータです。
まず testU01 で検定した結果の要約を示します。
type                    , c, test                      , p-value
QnxRand 3A rawhi Seed(1), B, Passed                    , -      
QnxRand 3A rawhi Seed(2), B, HammingIndep,L=30,r=27    , 5.0e-5 
QnxRand 3A rawhi Seed(3), B, Passed                    , -      
QnxRand 3A rawhi Seed(4), B, Passed                    , -      
QnxRand 3A rawhi Seed(5), B, Passed                    , -      
QnxRand 3A rawhi Seed(6), B, Passed                    , -      
QnxRand 3A rawlo Seed(1), B, Passed                    , -      
QnxRand 3A rawlo Seed(2), B, Passed                    , -      
QnxRand 3A rawlo Seed(3), B, Passed                    , -      
QnxRand 3A rawlo Seed(4), B, Passed                    , -      
QnxRand 3A rawlo Seed(5), B, LinearComp,r=29           , 6.7e-5 
QnxRand 3A rawlo Seed(6), B, Passed                    , -      
QnxRand 3A revhi Seed(1), B, ClosePairs NJumps,t=3     , 0.9991 
QnxRand 3A revhi Seed(2), B, Passed                    , -      
QnxRand 3A revhi Seed(3), B, Passed                    , -      
QnxRand 3A revhi Seed(4), B, Passed                    , -      
QnxRand 3A revhi Seed(5), B, Passed                    , -      
QnxRand 3A revhi Seed(6), B, Passed                    , -      
QnxRand 3A revlo Seed(1), B, Passed                    , -      
QnxRand 3A revlo Seed(2), B, CollisionOver,t=14        , 0.9994 
-                       , B, RandomWalk1 J(L=10000,r=0), 0.9992 
QnxRand 3A revlo Seed(3), B, MaxOft AD,t=16            , 7.9e-4 
QnxRand 3A revlo Seed(4), B, Passed                    , -      
QnxRand 3A revlo Seed(5), B, Passed                    , -      
QnxRand 3A revlo Seed(6), B, Passed                    , -      
QnxRand 3A swphi Seed(1), B, Passed                    , -      
QnxRand 3A swphi Seed(2), B, Passed                    , -      
QnxRand 3A swphi Seed(3), B, MatrixRank,L=30,r=26      , 0.9997 
QnxRand 3A swphi Seed(4), B, Passed                    , -      
QnxRand 3A swphi Seed(5), B, Passed                    , -      
QnxRand 3A swphi Seed(6), B, Passed                    , -      
QnxRand 3A swplo Seed(1), B, Passed                    , -      
QnxRand 3A swplo Seed(2), B, Passed                    , -      
QnxRand 3A swplo Seed(3), B, Passed                    , -      
QnxRand 3A swplo Seed(4), B, Passed                    , -      
QnxRand 3A swplo Seed(5), B, Passed                    , -      
QnxRand 3A swplo Seed(6), B, Passed                    , -
このように rdrand とほぼ同じ品質であることがわかります。

AncRandをPractRand ver0.96で検定する

次に PractRand ver0.96 での検定です。
以下の6つの検定をしました。
(1)RNG_test stdin64 -tlmin 1GB -multithreaded
(2)RNG_test stdin64 -tlmin 1GB -tf 2 -multithreaded
(3)RNG_test stdin64 -tlmin 1GB -te 1 -tlmax 8TB -multithreaded
(4)RNG_test stdin64 -tlmin 1GB -te 1 -tf 2 -tlmax 8TB -multithreaded
(5)RNG_test stdin64 -tlmin 1GB -te 10 -tlmax 8TB -multithreaded
(6)RNG_test stdin64 -tlmin 1GB -te 10 -tf 2 -tlmax 8TB -multithreaded
本来は -te 1 や -te 10 でも既定の 32TB まで検定したかったのですが、
-te 0 に比べて時間がかかるので 8TB までにしました。
(1),(3),(4),(5),(6)は、種1で異常はありませんでした。
(2)RNG_test stdin64 -tlmin 1GB -tf 2 -multithreadedは、種1で、
RNG_test stdin64 -tlmin 1GB -tf 2 -multithreaded
QnxRand te0 tf2 3A Seed(1)
RNG_test using PractRand version 0.96
RNG = RNG_stdin64, seed = unknown
test set = core, folding = extra
...
length= 32 terabytes (2^45 bytes), time= 143463 seconds
  Test Name                         Raw       Processed     Evaluation       
  [Low4/16]BCFN(2+1,13-0U)          R=  +9.3  p =  1.5e-4   unusual          

となりましたが、種2で、1GB から 32TB まで異常はありませんでした。

PractRand ver0.96で QncRand を種を1~40にして 1GB, 2GB, 4GB の3つの長さで、 異常のあったものを表示します。
この120回分を1つのテストとします。
-te 0 を te0、-te 1 を te1、-tf 1 を tf1、-tf 2 を te2 と表します。
1つのテストを(te0,te1)と(tf1,tf2)の4個の組み合わせをテストして合計480回調べました。

AncRand 3A te0 tf1 Seed(7) 4GB  [Low16/64]BCFN(2+3,13-1U) p=2.1e-4 unusual 
AncRand 3A te0 tf1 Seed(8) 4GB  DC6-9x1Bytes-1 p=1-1.5e-3 unusual 
AncRand 3A te0 tf1 Seed(17) 4GB  [Low1/64]DC6-9x1Bytes-1 p=1-2.8e-3 unusual 
AncRand 3A te0 tf1 Seed(23) 4GB  [Low4/64]BCFN(2+0,13-2U) p=1-8.7e-4 unusual 
AncRand 3A te0 tf1 Seed(28) 2GB  FPF/16:all p=1-9.2e-5 unusual 
AncRand 3A te0 tf1 Seed(30) 1GB  [Low4/64]DC6-9x1Bytes-1 p=1-3.6e-4 mildly suspicious
AncRand 3A te0 tf1 Seed(31) 2GB  DC6-9x1Bytes-1 p=1.3e-3 unusual 
AncRand 3A te0 tf1 Seed(31) 4GB  DC6-9x1Bytes-1 p=2.0e-4 mildly suspicious
AncRand 3A te0 tf1 Seed(35) 2GB  DC6-9x1Bytes-1 p=1.8e-3 unusual 
AncRand 3A te0 tf1 Seed(37) 1GB  [Low16/64]DC6-9x1Bytes-1 p=1.6e-3 unusual 
AncRand 3A te0 tf2 Seed(6) 2GB  [Low4/16]Gap-16:A p=1-3.0e-4 unusual 
AncRand 3A te0 tf2 Seed(8) 4GB  DC6-9x1Bytes-1 p=1-1.5e-3 unusual 
AncRand 3A te0 tf2 Seed(11) 4GB  [Low1/16]DC6-9x1Bytes-1 p=1.2e-3 unusual 
AncRand 3A te0 tf2 Seed(16) 1GB  [Low8/64]FPF/16:all p=1.8e-4 unusual 
AncRand 3A te0 tf2 Seed(28) 2GB  FPF/16:all p=1-9.2e-5 unusual 
AncRand 3A te0 tf2 Seed(30) 1GB  [Low4/64]DC6-9x1Bytes-1 p=1-3.6e-4 unusual 
AncRand 3A te0 tf2 Seed(30) 2GB  [Low1/16]DC6-9x1Bytes-1 p=1.0e-3 unusual 
AncRand 3A te0 tf2 Seed(31) 1GB  [Low4/32]DC6-9x1Bytes-1 p=1-1.3e-4 mildly suspicious
AncRand 3A te0 tf2 Seed(31) 2GB  DC6-9x1Bytes-1 p=1.3e-3 unusual 
AncRand 3A te0 tf2 Seed(31) 4GB  DC6-9x1Bytes-1 p=2.0e-4 unusual 
AncRand 3A te1 tf1 Seed(12) 4GB  [Low1/64][C8]BCFN(2+5,13-8U) p=6.1e-6 unusual 
AncRand 3A te1 tf1 Seed(14) 1GB  [Low1/64]BCFN(0+1,13-4U) p=9.5e-5 unusual 
AncRand 3A te1 tf1 Seed(18) 1GB  [Low16/64]FPF/64:all p=3.2e-5 unusual 
AncRand 3A te1 tf1 Seed(26) 2GB  NS3[3:hw:both] p=8.2e-5 unusual 
AncRand 3A te1 tf1 Seed(27) 4GB  DC7-6x2Bytes-1:indep p=1-1e-4 unusual 
AncRand 3A te1 tf1 Seed(29) 4GB  NS3[6:hw:both] p=5.1e-5 unusual 
AncRand 3A te1 tf1 Seed(30) 1GB  [Low4/64]DC7-9x1Bytes-1:both p=1-3.6e-4 unusual 
AncRand 3A te1 tf1 Seed(31) 4GB  DC7-9x1Bytes-1:both p=2.0e-4 unusual 
AncRand 3A te1 tf1 Seed(40) 1GB  [Low1/64]DC7-6x2Bytes-1:indep p=1-1e-4 unusual 
AncRand 3A te1 tf2 Seed(10) 2GB  [Low1/32]NS3[4:hw:both] p=5.2e-6 unusual 
AncRand 3A te1 tf2 Seed(31) 1GB  [Low4/32]DC7-9x1Bytes-1:both p=1-1.3e-4 unusual 
AncRand 3A te1 tf2 Seed(31) 4GB  DC7-9x1Bytes-1:both p=2.0e-4 unusual 
te0 で mildly suspicious が出現しますが、p-value を見ると極端ではありません。
また、rdrandをtestU01とPractRand ver0.96で検定するの 結論より問題ありません。
従って、rdrand とほぼ同じ品質であることがわかります。

ANC の SSE や AVX のプログラムは、 周期の長さが変わらないのに多くのメモリを必要とするので用意しませんでした。

[前:SplitMix64について]   [ExRand目次]   [次:SplitMix64とXorshiftを組み合わせる(大型)]