[前:rdrandをtestU01とPractRandで検定する]   [ExRand目次]   [次:SplitMix64とXorshiftを組み合わせる]

[SNC]SplitMix64について

目次

[SNC]SplitMix64について

状態の大きさが64ビットの高速で質の高い疑似乱数 SplitMix64 があります。

SplitMix64 https://github.com/svaarala/duktape/blob/master/misc/splitmix64.c

以下は SplitMix64 をマルチスレッド用に書き替え、逆順とジャンプを加えたものです。

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

define.h はこちら

これは状態の大きさが64ビットしかないので、周期が短いという欠点があります。
そこで SplitMix64 のコメントにはマルチスレッドでは xoroshiro128+ を、
大規模な計算では xorshift1024* を使うように勧めています。
しかし、この2つの疑似乱数は、
testingRNG : testing popular random-number generators(https://github.com/lemire/testingRNG)
検定に失敗すると書かれています。

SplitMix64をtestU01で検定する

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をPractRandで検定する

SplitMix64 も既定の PractRand(folding=standard:-tf 1) では合格しますが、
'RNG_test stdin64 -tf 2 -multithreaded' として(folding=extra:-tf 2)とすると失敗します。

種が1の場合。

RNG_test stdin64 -tlmin 1GB -tf 2 -multithreaded

length= 8 terabytes (2^43 bytes), time= 45280 seconds
  Test Name                         Raw       Processed     Evaluation
  [Low8/32]Gap-16:B                 R=  +9.2  p =  8.7e-8   very suspicious  

length= 16 terabytes (2^44 bytes), time= 90304 seconds
  Test Name                         Raw       Processed     Evaluation
  [Low8/32]Gap-16:A                 R= +11.5  p =  6.2e-8   very suspicious  
  [Low8/32]Gap-16:B                 R= +17.7  p =  5.0e-15    FAIL           

種が2の場合。

RNG_test stdin64 -tlmin 1GB -tf 2 -multithreaded

length= 8 terabytes (2^43 bytes), time= 45567 seconds
  Test Name                         Raw       Processed     Evaluation
  [Low8/32]Gap-16:B                 R=  +7.1  p =  5.4e-6   mildly suspicious

length= 16 terabytes (2^44 bytes), time= 90853 seconds
  Test Name                         Raw       Processed     Evaluation
  [Low8/32]Gap-16:A                 R=  +9.3  p =  1.9e-6   suspicious       
  [Low8/32]Gap-16:B                 R= +15.7  p =  2.7e-13    FAIL           

種が3の場合。

RNG_test stdin64 -tlmin 1GB -tf 2 -multithreaded

length= 8 terabytes (2^43 bytes), time= 30360 seconds
  Test Name                         Raw       Processed     Evaluation
  [Low8/32]Gap-16:A                 R=  +7.6  p =  2.6e-5   mildly suspicious
  [Low8/32]Gap-16:B                 R= +11.3  p =  1.4e-9    VERY SUSPICIOUS 

length= 16 terabytes (2^44 bytes), time= 59639 seconds
  Test Name                         Raw       Processed     Evaluation
  [Low8/32]Gap-16:A                 R= +12.6  p =  1.2e-8   very suspicious  
  [Low8/32]Gap-16:B                 R= +17.4  p =  7.9e-15    FAIL           

このように種1,2,3で検定すると不合格になって途中で終わってしまいます。

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

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

define.h, bincode.h はこちら
bincode.h は Visual C++2002 と Visual C++ 2003 以外では必要ありません。

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

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

define.h, bincode.h はこちら

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

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

define.h はこちら

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

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

define.h, bincode.h はこちら

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

gcc, clang, vc2017 .. vc2022 でコンパイル可能です。

define.h はこちら

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

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

define.h, bincode.h はこちら

[前:rdrandをtestU01とPractRandで検定する]   [ExRand目次]   [次:SplitMix64とXorshiftを組み合わせる]