[前:SplitMix64とXorshiftを組み合わせる(小型)]   [ExRand目次]   [次:SplitMix64とXorshiftを組み合わせる(高機能版)]

[QNC]SplitMix64とXorshiftを組み合わせる(大型)

目次

[QNC]SplitMix64とXorshiftを組み合わせる(大型)

anc.h の周期の長さは2²⁵⁶-2⁶⁴ ですが、大規模な実験では不十分かもしれません。
そこで、周期を2⁷⁰⁴-2⁶⁴ にした qnc.h を開発しました。

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

QncRandをtestU01で検定する

QnxRand は QncRand をより一般化した疑似乱数です。
10U は QnxRand を QncRand と同じにするパラメータです。
まず testU01 で検定した結果の要約を示します。
type                     , c, test                    , p-value
QnxRand 10U rawhi Seed(1), B, Passed                  , -      
QnxRand 10U rawhi Seed(2), B, Passed                  , -      
QnxRand 10U rawhi Seed(3), B, RandomWalk1 M(L=50,r=25), 6.9e-4 
QnxRand 10U rawhi Seed(4), B, Passed                  , -      
QnxRand 10U rawhi Seed(5), B, Passed                  , -      
QnxRand 10U rawhi Seed(6), B, Passed                  , -      
QnxRand 10U rawlo Seed(1), B, Passed                  , -      
QnxRand 10U rawlo Seed(2), B, Passed                  , -      
QnxRand 10U rawlo Seed(3), B, MatrixRank,L=1000,r=0   , 0.9995 
QnxRand 10U rawlo Seed(4), B, Passed                  , -      
QnxRand 10U rawlo Seed(5), B, Passed                  , -      
QnxRand 10U rawlo Seed(6), B, ClosePairs mNP2,t=5     , 8.3e-4 
QnxRand 10U revhi Seed(1), B, Passed                  , -      
QnxRand 10U revhi Seed(2), B, Passed                  , -      
QnxRand 10U revhi Seed(3), B, Passed                  , -      
QnxRand 10U revhi Seed(4), B, CollisionOver,t=21      , 6.0e-4 
-                        , B, AppearanceSpacings,r=27 , 2.4e-4 
QnxRand 10U revhi Seed(5), B, MatrixRank,L=30,r=0     , 9.1e-4 
-                        , B, LempelZiv,r=15          , 3.9e-4 
QnxRand 10U revhi Seed(6), B, Passed                  , -      
QnxRand 10U revlo Seed(1), B, Passed                  , -      
QnxRand 10U revlo Seed(2), B, Passed                  , -      
QnxRand 10U revlo Seed(3), B, Passed                  , -      
QnxRand 10U revlo Seed(4), B, Passed                  , -      
QnxRand 10U revlo Seed(5), B, HammingCorr,L=1200      , 4.5e-4 
QnxRand 10U revlo Seed(6), B, Passed                  , -      
QnxRand 10U swphi Seed(1), B, WeightDistrib,r=28      , 9.8e-4 
QnxRand 10U swphi Seed(2), B, Passed                  , -      
QnxRand 10U swphi Seed(3), B, CollisionOver,t=3       , 0.9994 
QnxRand 10U swphi Seed(4), B, Passed                  , -      
QnxRand 10U swphi Seed(5), B, CollisionOver,t=21      , 9.4e-4 
QnxRand 10U swphi Seed(6), B, Passed                  , -      
QnxRand 10U swplo Seed(1), B, Passed                  , -      
QnxRand 10U swplo Seed(2), B, Passed                  , -      
QnxRand 10U swplo Seed(3), B, Passed                  , -      
QnxRand 10U swplo Seed(4), B, Passed                  , -      
QnxRand 10U swplo Seed(5), B, Passed                  , -      
QnxRand 10U swplo Seed(6), B, MaxOft AD,t=8           , 3.9e-4 
-                        , B, Savir2                  , 0.9997 
このように rdrand とほぼ同じ品質であることがわかります。

QncRandを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 までにしました。
(3),(4),(5),(6)は、種1で異常はありませんでした。
(1)RNG_test stdin64 -tlmin 1GB -tf 2 -multithreadedは、種1で、
RNG_test stdin64 -tlmin 1GB -te 0 -tf 1 -multithreaded
QnxRand te0 tf1 10U Seed(1)
RNG_test using PractRand version 0.96
RNG = RNG_stdin64, seed = unknown
test set = core, folding = standard (64 bit)
...
length= 256 gigabytes (2^38 bytes), time= 1092 seconds
  Test Name                         Raw       Processed     Evaluation       
  [Low4/64]DC6-9x1Bytes-1           R=  -4.9  p =1-2.8e-3   unusual          
...
length= 32 terabytes (2^45 bytes), time= 136572 seconds
  no anomalies in 400 test result(s)

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

(2)RNG_test stdin64 -tlmin 1GB -tf 2 -multithreadedは、種1で、
RNG_test stdin64 -tlmin 1GB -te 0 -tf 2 -multithreaded
QnxRand te0 tf2 10U Seed(1)
RNG_test using PractRand version 0.96
RNG = RNG_stdin64, seed = unknown
test set = core, folding = extra
...
length= 4 gigabytes (2^32 bytes), time= 26.1 seconds
  Test Name                         Raw       Processed     Evaluation       
  [Low1/32]Gap-16:A                 R=  -4.5  p =1-2.8e-4   unusual          
...
length= 16 terabytes (2^44 bytes), time= 98920 seconds
  Test Name                         Raw       Processed     Evaluation       
  [Low8/32]BCFN(2+1,13-0U)          R=  -8.3  p =1-2.4e-4   unusual          
  ...and 975 test result(s) without anomalies
...
length= 32 terabytes (2^45 bytes), time= 197618 seconds
  no anomalies in 996 test result(s)

となりましたが、種8で、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回調べました。

QnxRand 10U te0 tf1 Seed(7) 4GB  [Low1/64]FPF/16:all p=1-1.0e-4 unusual 
QnxRand 10U te0 tf1 Seed(12) 2GB  DC6-9x1Bytes-1 p=4.7e-4 unusual 
QnxRand 10U te0 tf1 Seed(27) 1GB  BRank(12):score:2560 p=1-4.0e-5 unusual 
QnxRand 10U te0 tf1 Seed(32) 1GB  [Low16/64]BRank(12):score:1792 p=4.2e-4 unusual 
QnxRand 10U te0 tf1 Seed(32) 2GB  [Low16/64]BRank(12):score:2048 p=4.4e-4 unusual 
QnxRand 10U te0 tf1 Seed(32) 2GB  [Low4/64]mod3n(5):(2,9-2) p=1.9e-4 unusual 
QnxRand 10U te0 tf1 Seed(32) 4GB  [Low16/64]BRank(12):score:2560 p=4.5e-4 unusual 
QnxRand 10U te0 tf1 Seed(37) 1GB  [Low1/64]DC6-9x1Bytes-1 p=1-1.5e-3 unusual 
QnxRand 10U te0 tf2 Seed(1) 4GB  [Low1/32]Gap-16:A p=1-2.8e-4 unusual 
QnxRand 10U te0 tf2 Seed(4) 1GB  [Low1/8]BCFN(2+1,13-3U) p=1-2.7e-4 unusual 
QnxRand 10U te0 tf2 Seed(7) 4GB  [Low1/64]FPF/16:all p=1-1.0e-4 unusual 
QnxRand 10U te0 tf2 Seed(12) 2GB  DC6-9x1Bytes-1 p=4.7e-4 unusual 
QnxRand 10U te0 tf2 Seed(17) 4GB  [Low1/16]Gap-16:A p=1-3.2e-4 unusual 
QnxRand 10U te0 tf2 Seed(21) 1GB  [Low8/32]Gap-16:A p=1-2.4e-4 unusual 
QnxRand 10U te0 tf2 Seed(23) 2GB  [Low1/16]DC6-9x1Bytes-1 p=8.3e-4 unusual 
QnxRand 10U te0 tf2 Seed(27) 1GB  BRank(12):score:2560 p=1-4.0e-5 unusual 
QnxRand 10U te0 tf2 Seed(28) 2GB  [Low1/32]DC6-9x1Bytes-1 p=1-6.1e-4 unusual 
QnxRand 10U te1 tf1 Seed(1) 2GB  [Low1/64]NS3[6:pd:both] p=1.1e-4 unusual 
QnxRand 10U te1 tf1 Seed(5) 4GB  NS3[3:pd:both] p=1.0e-4 unusual 
QnxRand 10U te1 tf1 Seed(12) 2GB  DC7-9x1Bytes-1:both p=4.7e-4 unusual 
QnxRand 10U te1 tf1 Seed(30) 2GB  FPF/4:cross p=1-8.3e-5 unusual 
QnxRand 10U te1 tf1 Seed(32) 1GB  [Low1/64]NS3[3:pd:both] p=2.5e-5 unusual 
QnxRand 10U te1 tf1 Seed(32) 2GB  [Low1/64]NS3[3:pd:both] p=8.9e-5 unusual 
QnxRand 10U te1 tf1 Seed(37) 1GB  [Low1/64]NS3[6:hw:both] p=5.8e-6 mildly suspicious
QnxRand 10U te1 tf2 Seed(6) 4GB  [Low8/32]NS3[0:pd:both] p=1.0e-4 unusual 
QnxRand 10U te1 tf2 Seed(9) 1GB  [Low4/64][C8]DC6-9x1Bytes-1 p=2.4e-4 unusual 
QnxRand 10U te1 tf2 Seed(29) 4GB  [Low1/8]DC7-5x4Bytes-1:even p=1.6e-5 unusual 
QnxRand 10U te1 tf2 Seed(32) 1GB  [Low1/64]NS3[3:pd:both] p=2.5e-5 unusual 
QnxRand 10U te1 tf2 Seed(35) 4GB  [Low4/32][C8]BCFN(2+0,13-4U) p=4.9e-5 unusual 
QnxRand 10U te1 tf2 Seed(36) 2GB  [Low1/32]NS3[6:hw:both] p=5.0e-6 unusual 
QnxRand 10U te1 tf2 Seed(37) 1GB  [Low1/64]NS3[6:hw:both] p=5.8e-6 unusual 
QnxRand 10U te1 tf2 Seed(39) 1GB  [Low1/32]NS3[5:hw:both] p=5.6e-7 mildly suspicious
QnxRand 10U te1 tf2 Seed(39) 1GB  [Low1/32]NS3[5:hw:all-] p=4.4e-6 unusual 
te1 で mildly suspicious が出現しますが、
rdrandをtestU01とPractRand ver0.96で検定するの 結論より問題ありません。
rdrand とほぼ同じ品質であることがわかります。

[QSC]組込み関数を使ったSSE2バージョン

gcc, clang, vc2002 .. vc2026 でコンパイル可能です。

define.h, bincode.h はこちら bincode.h は Visual C++2002 と Visual C++ 2003 でのみ必要です。

[QSB]機械語を使ったSSE2バージョン

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

define.h, bincode.h はこちら

[QAC]組込み関数を使ったAVX2バージョン

gcc, clang, VC++2013.. VC++2026 でコンパイル可能です。

define.h はこちら

[QAB]機械語を使ったAVX2バージョン

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

define.h, bincode.h はこちら

[QBC]組込み関数を使ったAVX512バージョン

gcc, clang, VC++2017 .. VC++2026 でコンパイル可能です。

define.h はこちら

[QBB]機械語を使ったAVX512バージョン

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

define.h, bincode.h はこちら

[前:SplitMix64とXorshiftを組み合わせる(小型)]   [ExRand目次]   [次:SplitMix64とXorshiftを組み合わせる(高機能版)]