[ExRand目次]   [次:SplitMix64について]

rdrandをtestU01とPractRan ver0.96で検定する

目次

testU01 と PractRand ver0.96 を知るために、
真の乱数に近い rdrand を testU01 と PractRand ver0.96 で検定してみました。
Seed(#)の#は回数を示すだけで乱数列には影響しません。
rdrand は再現性がないので、結果は検定する度に変化します。

結論

rdrandの速さについて

rdrand は第3世代以降のCPUで使用可能です。
rdrand は疑似乱数と比較して非常に遅いです。
第10世代の Core i5-10500T+Windows11 23H2 上で実行して、
このページの「testU01で検定する」の結果を得るのに3日半かかりました。
第11世代のCPUでは rdrand はさらに約40倍時間がかかります。
つまり、結果を得るのに約4か月半かかることになります。
第10世代以前のCPUでも Windows11 24H2 以降の場合、C:\Windows\System32にある
mcupdate_GenuineIntel.dll をリネームする必要があります。リネームの方法は、
日記という名の不定記 https://griffonworks.net/~yamagin/diary/archive/6854.php
が参考になります。
ただし、リネームするとOSが起動しなくなる可能性があります。
Ubuntu の場合は、
ハードウエア乱数の生成速度 https://isaku-wada.my.coocan.jp/tips/hrng.html
で説明しました。
どちらの場合もPCが脆弱になるのでお勧めできません。
自己責任でお願いします。検定が終わったら元に戻しましょう。

rnc.h

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

define.h はこちら

roc.h

roc.h は rnc.h を OpenMP でマルチスレッド化したプログラムです。

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

直前の rnc.h と define.h が必要です。

define.h はこちら

rdrandをtestU01で検定する

以下にtestU01で検定した結果の要約を示します。

type                 , c, test                     , p-value 
RocRand rawhi Seed(1), B, ClosePairs mNP2,t=3      , 4.9e-4  
RocRand rawhi Seed(2), B, CollisionOver,t=3        , 3.4e-4  
RocRand rawhi Seed(3), B, Passed                   , -       
RocRand rawhi Seed(4), B, Passed                   , -       
RocRand rawhi Seed(5), B, Passed                   , -       
RocRand rawhi Seed(6), B, Passed                   , -       
RocRand rawlo Seed(1), B, Passed                   , -       
RocRand rawlo Seed(2), B, Passed                   , -       
RocRand rawlo Seed(3), B, Passed                   , -       
RocRand rawlo Seed(4), B, Passed                   , -       
RocRand rawlo Seed(5), B, Passed                   , -       
RocRand rawlo Seed(6), B, LongestHeadRun,r=27      , 0.9995  
RocRand revhi Seed(1), B, Passed                   , -       
RocRand revhi Seed(2), B, Passed                   , -       
RocRand revhi Seed(3), B, Passed                   , -       
RocRand revhi Seed(4), B, CollisionOver,t=3        , 0.9991  
RocRand revhi Seed(5), B, RandomWalk1 R(L=1000,r=0), 2.4e-4  
-                    , B, AutoCor,d=1,r=0          , 3.5e-4  
RocRand revhi Seed(6), B, Passed                   , -       
RocRand revlo Seed(1), B, Passed                   , -       
RocRand revlo Seed(2), B, CollisionOver,t=21       , 8.6e-4  
RocRand revlo Seed(3), B, CouponCollector,r=20     , 6.2e-4  
-                    , B, RandomWalk1 M(L=50,r=25) , 8.5e-4  
RocRand revlo Seed(4), B, Passed                   , -       
RocRand revlo Seed(5), B, Passed                   , -       
RocRand revlo Seed(6), B, LempelZiv,r=15           , 1-9.9e-5
-                    , B, Run of bits,r=27         , 1.0e-3  
RocRand swphi Seed(1), B, Passed                   , -       
RocRand swphi Seed(2), B, Passed                   , -       
RocRand swphi Seed(3), B, Passed                   , -       
RocRand swphi Seed(4), B, CollisionOver,t=14       , 1-6.0e-5
RocRand swphi Seed(5), B, CollisionOver,t=7        , 0.9997  
-                    , B, SampleProd,t=16          , 2.4e-4  
RocRand swphi Seed(6), B, Passed                   , -       
RocRand swplo Seed(1), B, PeriodsInStrings,r=0     , 9.5e-4  
RocRand swplo Seed(2), B, Passed                   , -       
RocRand swplo Seed(3), B, Passed                   , -       
RocRand swplo Seed(4), B, Passed                   , -       
RocRand swplo Seed(5), B, Passed                   , -       
RocRand swplo Seed(6), B, Passed                   , -       

rawhi は64ビットの上位32ビットを検定の対象としたものです。
rawlo は64ビットの下位32ビットを検定の対象としたものです。
revhi, revlo はビット毎に順序を反転したものです。
swphi, swplo はバイト毎に順序を反転したものです。
B は BigCrush を意味します。
このように、何度も検定すると何回か異常と判断されます。

rdrandをPractRand ver0.96で検定する

PractRand ver0.96で rdrand を40回 1GB, 2GB, 4GB の3つの長さで、 異常のあったものを表示します。
この120回分を1つのテストとします。
-te 0 を te0、-te 1 を te1、-tf 1 を tf1、-tf 2 を te2 と表します。
PractRand pre0.95 では -te 10 にて 8GB 以下でも結果を出力していましたが、
PractRand ver0.96 では出力しないようになりました。
1つのテストを(te0,te1)と(tf1,tf2)の4個の組み合わせをテストして合計480回調べました。
RocRand te0 tf1 Seed(11) 1GB  DC6-9x1Bytes-1 p=1.6e-3 unusual 
RocRand te0 tf1 Seed(12) 2GB  [Low1/64]BCFN(2+0,13-4U) p=1-6.1e-4 unusual 
RocRand te0 tf1 Seed(17) 4GB  [Low16/64]DC6-9x1Bytes-1 p=3.4e-3 unusual 
RocRand te0 tf1 Seed(20) 1GB  BCFN(2+1,13-1U) p=9.2e-5 unusual 
RocRand te0 tf1 Seed(24) 4GB  [Low1/64]Gap-16:B p=8.9e-4 unusual 
RocRand te0 tf1 Seed(25) 2GB  [Low1/64]DC6-9x1Bytes-1 p=2.3e-3 unusual 
RocRand te0 tf1 Seed(40) 1GB  [Low1/64]Gap-16:B p=1-6.6e-4 unusual 
RocRand te0 tf2 Seed(2) 4GB  [Low4/32]DC6-9x1Bytes-1 p=1-1.4e-3 unusual 
RocRand te0 tf2 Seed(4) 1GB  [Low1/16]DC6-9x1Bytes-1 p=1-1.2e-3 unusual 
RocRand te0 tf2 Seed(11) 1GB  [Low1/8]DC6-9x1Bytes-1 p=1.0e-3 unusual 
RocRand te0 tf2 Seed(11) 2GB  [Low1/8]DC6-9x1Bytes-1 p=5.9e-4 unusual 
RocRand te0 tf2 Seed(15) 4GB  [Low8/64]DC6-9x1Bytes-1 p=1-2.8e-4 unusual 
RocRand te0 tf2 Seed(16) 4GB  [Low4/32]Gap-16:B p=1.5e-4 unusual 
RocRand te0 tf2 Seed(20) 2GB  [Low4/32]Gap-16:A p=1-1.0e-4 unusual 
RocRand te0 tf2 Seed(27) 4GB  [Low1/8]DC6-9x1Bytes-1 p=1-1.0e-3 unusual 
RocRand te0 tf2 Seed(38) 1GB  [Low1/32]BCFN(2+0,13-4U) p=3.4e-4 unusual 
RocRand te0 tf2 Seed(40) 1GB  [Low1/16]BCFN(2+2,13-4U) p=2.8e-4 unusual
RocRand te1 tf1 Seed(11) 4GB  [C8]BCFN(2+0,13-2U) p=1.3e-4 unusual 
RocRand te1 tf1 Seed(19) 1GB  [Low4/64][C8]BCFN(2+1,13-6U) p=2.7e-6 mildly suspicious
RocRand te1 tf1 Seed(37) 4GB  [Low1/64]NS3[6:hw:both] p=1.7e-5 unusual 
RocRand te1 tf2 Seed(9) 2GB  [Low4/32]NS3[3:pd:both] p=1-6.8e-5 unusual 
RocRand te1 tf2 Seed(9) 4GB  [Low8/32]NS3[0:hw:both] p=3.4e-5 unusual 
RocRand te1 tf2 Seed(14) 1GB  [Low4/16]NS3[5:hw:both] p=2.5e-5 unusual 
RocRand te1 tf2 Seed(19) 1GB  [Low1/32]NS3[6:hw:both] p=2.2e-6 mildly suspicious
RocRand te1 tf2 Seed(21) 2GB  NS3[3:hw:both] p=3.2e-5 unusual 
RocRand te1 tf2 Seed(29) 4GB  [Low4/64]DC7-6x2Bytes-1:indep p=1-4e-5 unusual 

rnb.h

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

define.h, bincode.h はこちら

rob.h

OpenMP が必要なため、Visual C++ では 2005 からコンパイル可能です。
直前の rnb.h と define.h, bincode.h が必要です。

define.h, bincode.h はこちら

[ExRand目次]   [次:SplitMix64について]