The purpose of this posting is to test and compare the quality of the random numbers generated by a SwiftRNG Pro device and those generated by PRNG (pseudorandom number generator) implementations available on Linux operating systems. In Linux-like operating systems, /dev/urandom is a special file that serves as a PRNG.

For our tests we used a /dev/urandom file available on a computer running CentOS 7 and a SwiftRNG Pro device plugged into one of the USB ports available on the same computer. The tests were performed by sampling 120 GB of random data from SwiftRNG Pro device with no ‘conditioning’ and from /dev/urandom. The sampled random data blocks were used to feed the ‘rngtest’ test suite for statistical analysis. We also tested SwiftRNG Pro and /dev/urandom random streams using the ‘dieharder’ test suite.

Testing with ‘rngtest’

The following charts represent comparison test results produced by ‘rngtest’. We are interested in the total number of FIPS 140-2 test failures and number of failures for each FIPS 140-2 specific test.

‘rngtest’ Conclusion

The total number of FIPS 140-2 failures was slightly higher for /dev/urandom compared to FIPS 140-2 failures for SwiftRNG Pro. SwiftRNG Pro produced less failures for FIPS 140-2 ‘Runs’, ‘Long Run’ and ‘Continuous Run’ tests while /dev/urandom produced less failures for FIPS 140-2 ‘Monobit’ and ‘Poker’ tests.

Testing with ‘dieharder’

The following are test results generated by ‘dieharder’ when testing random byte stream produced by SwiftRNG Pro device with no ‘conditioning’:

swrng -dd -fn STDOUT | dieharder -g 200 -a
#=============================================================================#
#            dieharder version 3.31.1 Copyright 2003 Robert G. Brown          #
#=============================================================================#
   rng_name    |rands/second|   Seed   |
stdin_input_raw|  5.52e+06  | 204447751|
#=============================================================================#
        test_name   |ntup| tsamples |psamples|  p-value |Assessment
#=============================================================================#
   diehard_birthdays|   0|       100|     100|0.23189457|  PASSED  
      diehard_operm5|   0|   1000000|     100|0.75095612|  PASSED  
  diehard_rank_32x32|   0|     40000|     100|0.96073461|  PASSED  
    diehard_rank_6x8|   0|    100000|     100|0.93232326|  PASSED  
   diehard_bitstream|   0|   2097152|     100|0.32747213|  PASSED  
        diehard_opso|   0|   2097152|     100|0.74231200|  PASSED  
        diehard_oqso|   0|   2097152|     100|0.09245298|  PASSED  
         diehard_dna|   0|   2097152|     100|0.30959114|  PASSED  
diehard_count_1s_str|   0|    256000|     100|0.86246827|  PASSED  
diehard_count_1s_byt|   0|    256000|     100|0.33426616|  PASSED  
 diehard_parking_lot|   0|     12000|     100|0.33358085|  PASSED  
    diehard_2dsphere|   2|      8000|     100|0.45323736|  PASSED  
    diehard_3dsphere|   3|      4000|     100|0.68247073|  PASSED  
     diehard_squeeze|   0|    100000|     100|0.04045060|  PASSED  
        diehard_sums|   0|       100|     100|0.15998991|  PASSED  
        diehard_runs|   0|    100000|     100|0.20507955|  PASSED  
        diehard_runs|   0|    100000|     100|0.81059682|  PASSED  
       diehard_craps|   0|    200000|     100|0.04558382|  PASSED  
       diehard_craps|   0|    200000|     100|0.45402435|  PASSED  
 marsaglia_tsang_gcd|   0|  10000000|     100|0.62754383|  PASSED  
 marsaglia_tsang_gcd|   0|  10000000|     100|0.53365537|  PASSED  
         sts_monobit|   1|    100000|     100|0.07245620|  PASSED  
            sts_runs|   2|    100000|     100|0.49969326|  PASSED  
          sts_serial|   1|    100000|     100|0.50668731|  PASSED  
          sts_serial|   2|    100000|     100|0.87844642|  PASSED  
          sts_serial|   3|    100000|     100|0.99987535|   WEAK   
          sts_serial|   3|    100000|     100|0.96930487|  PASSED  
          sts_serial|   4|    100000|     100|0.50879386|  PASSED  
          sts_serial|   4|    100000|     100|0.22925809|  PASSED  
          sts_serial|   5|    100000|     100|0.41114562|  PASSED  
          sts_serial|   5|    100000|     100|0.85418243|  PASSED  
          sts_serial|   6|    100000|     100|0.52907030|  PASSED  
          sts_serial|   6|    100000|     100|0.79775328|  PASSED  
          sts_serial|   7|    100000|     100|0.25207091|  PASSED  
          sts_serial|   7|    100000|     100|0.45934295|  PASSED  
          sts_serial|   8|    100000|     100|0.44472162|  PASSED  
          sts_serial|   8|    100000|     100|0.54690406|  PASSED  
          sts_serial|   9|    100000|     100|0.75462311|  PASSED  
          sts_serial|   9|    100000|     100|0.59246043|  PASSED  
          sts_serial|  10|    100000|     100|0.65093398|  PASSED  
          sts_serial|  10|    100000|     100|0.36015871|  PASSED  
          sts_serial|  11|    100000|     100|0.83071639|  PASSED  
          sts_serial|  11|    100000|     100|0.99480125|  PASSED  
          sts_serial|  12|    100000|     100|0.88728666|  PASSED  
          sts_serial|  12|    100000|     100|0.84685621|  PASSED  
          sts_serial|  13|    100000|     100|0.44996132|  PASSED  
          sts_serial|  13|    100000|     100|0.84783628|  PASSED  
          sts_serial|  14|    100000|     100|0.54973990|  PASSED  
          sts_serial|  14|    100000|     100|0.98901587|  PASSED  
          sts_serial|  15|    100000|     100|0.92734287|  PASSED  
          sts_serial|  15|    100000|     100|0.74516197|  PASSED  
          sts_serial|  16|    100000|     100|0.65420669|  PASSED  
          sts_serial|  16|    100000|     100|0.91095922|  PASSED  
         rgb_bitdist|   1|    100000|     100|0.28196469|  PASSED  
         rgb_bitdist|   2|    100000|     100|0.20311887|  PASSED  
         rgb_bitdist|   3|    100000|     100|0.83371006|  PASSED  
         rgb_bitdist|   4|    100000|     100|0.97918552|  PASSED  
         rgb_bitdist|   5|    100000|     100|0.33633146|  PASSED  
         rgb_bitdist|   6|    100000|     100|0.45049719|  PASSED  
         rgb_bitdist|   7|    100000|     100|0.84676874|  PASSED  
         rgb_bitdist|   8|    100000|     100|0.18405803|  PASSED  
         rgb_bitdist|   9|    100000|     100|0.17870007|  PASSED  
         rgb_bitdist|  10|    100000|     100|0.34093733|  PASSED  
         rgb_bitdist|  11|    100000|     100|0.98757745|  PASSED  
         rgb_bitdist|  12|    100000|     100|0.33608530|  PASSED  
rgb_minimum_distance|   2|     10000|    1000|0.40714300|  PASSED  
rgb_minimum_distance|   3|     10000|    1000|0.01359258|  PASSED  
rgb_minimum_distance|   4|     10000|    1000|0.40526430|  PASSED  
rgb_minimum_distance|   5|     10000|    1000|0.00015977|   WEAK   
    rgb_permutations|   2|    100000|     100|0.42947333|  PASSED  
    rgb_permutations|   3|    100000|     100|0.70231583|  PASSED  
    rgb_permutations|   4|    100000|     100|0.14559228|  PASSED  
    rgb_permutations|   5|    100000|     100|0.39820769|  PASSED  
      rgb_lagged_sum|   0|   1000000|     100|0.95478426|  PASSED  
      rgb_lagged_sum|   1|   1000000|     100|0.48808137|  PASSED  
      rgb_lagged_sum|   2|   1000000|     100|0.75232711|  PASSED  
      rgb_lagged_sum|   3|   1000000|     100|0.30510638|  PASSED  
      rgb_lagged_sum|   4|   1000000|     100|0.32466480|  PASSED  
      rgb_lagged_sum|   5|   1000000|     100|0.34657161|  PASSED  
      rgb_lagged_sum|   6|   1000000|     100|0.79797715|  PASSED  
      rgb_lagged_sum|   7|   1000000|     100|0.69093277|  PASSED  
      rgb_lagged_sum|   8|   1000000|     100|0.62220023|  PASSED  
      rgb_lagged_sum|   9|   1000000|     100|0.75880907|  PASSED  
      rgb_lagged_sum|  10|   1000000|     100|0.60912315|  PASSED  
      rgb_lagged_sum|  11|   1000000|     100|0.68534716|  PASSED  
      rgb_lagged_sum|  12|   1000000|     100|0.56160475|  PASSED  
      rgb_lagged_sum|  13|   1000000|     100|0.50051735|  PASSED  
      rgb_lagged_sum|  14|   1000000|     100|0.03065363|  PASSED  
      rgb_lagged_sum|  15|   1000000|     100|0.46737147|  PASSED  
      rgb_lagged_sum|  16|   1000000|     100|0.96676303|  PASSED  
      rgb_lagged_sum|  17|   1000000|     100|0.63337053|  PASSED  
      rgb_lagged_sum|  18|   1000000|     100|0.62142304|  PASSED  
      rgb_lagged_sum|  19|   1000000|     100|0.04809293|  PASSED  
      rgb_lagged_sum|  20|   1000000|     100|0.71276787|  PASSED  
      rgb_lagged_sum|  21|   1000000|     100|0.78284283|  PASSED  
      rgb_lagged_sum|  22|   1000000|     100|0.39360698|  PASSED  
      rgb_lagged_sum|  23|   1000000|     100|0.06632147|  PASSED  
      rgb_lagged_sum|  24|   1000000|     100|0.79035290|  PASSED  
      rgb_lagged_sum|  25|   1000000|     100|0.22745596|  PASSED  
      rgb_lagged_sum|  26|   1000000|     100|0.98940777|  PASSED  
      rgb_lagged_sum|  27|   1000000|     100|0.59552952|  PASSED  
      rgb_lagged_sum|  28|   1000000|     100|0.76529954|  PASSED  
      rgb_lagged_sum|  29|   1000000|     100|0.96033546|  PASSED  
      rgb_lagged_sum|  30|   1000000|     100|0.34793801|  PASSED  
      rgb_lagged_sum|  31|   1000000|     100|0.56710980|  PASSED  
      rgb_lagged_sum|  32|   1000000|     100|0.87580841|  PASSED  
     rgb_kstest_test|   0|     10000|    1000|0.59457755|  PASSED  
     dab_bytedistrib|   0|  51200000|       1|0.26956602|  PASSED  
             dab_dct| 256|     50000|       1|0.43445042|  PASSED  
Preparing to run test 207.  ntuple = 0
        dab_filltree|  32|  15000000|       1|0.95997359|  PASSED  
        dab_filltree|  32|  15000000|       1|0.69594477|  PASSED  
Preparing to run test 208.  ntuple = 0
       dab_filltree2|   0|   5000000|       1|0.69858902|  PASSED  
       dab_filltree2|   1|   5000000|       1|0.76921713|  PASSED  
Preparing to run test 209.  ntuple = 0
        dab_monobit2|  12|  65000000|       1|0.85449699|  PASSED  

The following are test results generated by ‘dieharder’ when testing random byte stream produced by /dev/urandom:

dd if=/dev/urandom bs=12000000 | dieharder -g 200 -a
#=============================================================================#
#            dieharder version 3.31.1 Copyright 2003 Robert G. Brown          #
#=============================================================================#
   rng_name    |rands/second|   Seed   |
stdin_input_raw|  3.06e+07  |2868936241|
#=============================================================================#
        test_name   |ntup| tsamples |psamples|  p-value |Assessment
#=============================================================================#
   diehard_birthdays|   0|       100|     100|0.95387771|  PASSED  
      diehard_operm5|   0|   1000000|     100|0.92560719|  PASSED  
  diehard_rank_32x32|   0|     40000|     100|0.98066045|  PASSED  
    diehard_rank_6x8|   0|    100000|     100|0.20597070|  PASSED  
   diehard_bitstream|   0|   2097152|     100|0.91045462|  PASSED  
        diehard_opso|   0|   2097152|     100|0.63316244|  PASSED  
        diehard_oqso|   0|   2097152|     100|0.93774044|  PASSED  
         diehard_dna|   0|   2097152|     100|0.41448575|  PASSED  
diehard_count_1s_str|   0|    256000|     100|0.57649363|  PASSED  
diehard_count_1s_byt|   0|    256000|     100|0.10827822|  PASSED  
 diehard_parking_lot|   0|     12000|     100|0.79252967|  PASSED  
    diehard_2dsphere|   2|      8000|     100|0.04975508|  PASSED  
    diehard_3dsphere|   3|      4000|     100|0.99585638|   WEAK   
     diehard_squeeze|   0|    100000|     100|0.24753753|  PASSED  
        diehard_sums|   0|       100|     100|0.05653317|  PASSED  
        diehard_runs|   0|    100000|     100|0.11453525|  PASSED  
        diehard_runs|   0|    100000|     100|0.19585625|  PASSED  
       diehard_craps|   0|    200000|     100|0.45638793|  PASSED  
       diehard_craps|   0|    200000|     100|0.31591645|  PASSED  
 marsaglia_tsang_gcd|   0|  10000000|     100|0.06850479|  PASSED  
 marsaglia_tsang_gcd|   0|  10000000|     100|0.81649089|  PASSED  
         sts_monobit|   1|    100000|     100|0.99831362|   WEAK   
            sts_runs|   2|    100000|     100|0.47933569|  PASSED  
          sts_serial|   1|    100000|     100|0.15918179|  PASSED  
          sts_serial|   2|    100000|     100|0.01980393|  PASSED  
          sts_serial|   3|    100000|     100|0.26391074|  PASSED  
          sts_serial|   3|    100000|     100|0.93825883|  PASSED  
          sts_serial|   4|    100000|     100|0.48042579|  PASSED  
          sts_serial|   4|    100000|     100|0.94648402|  PASSED  
          sts_serial|   5|    100000|     100|0.88404757|  PASSED  
          sts_serial|   5|    100000|     100|0.63829590|  PASSED  
          sts_serial|   6|    100000|     100|0.87264060|  PASSED  
          sts_serial|   6|    100000|     100|0.99025369|  PASSED  
          sts_serial|   7|    100000|     100|0.52913922|  PASSED  
          sts_serial|   7|    100000|     100|0.20699735|  PASSED  
          sts_serial|   8|    100000|     100|0.51858724|  PASSED  
          sts_serial|   8|    100000|     100|0.93935828|  PASSED  
          sts_serial|   9|    100000|     100|0.89045694|  PASSED  
          sts_serial|   9|    100000|     100|0.97967948|  PASSED  
          sts_serial|  10|    100000|     100|0.82805945|  PASSED  
          sts_serial|  10|    100000|     100|0.94576847|  PASSED  
          sts_serial|  11|    100000|     100|0.87463478|  PASSED  
          sts_serial|  11|    100000|     100|0.41233150|  PASSED  
          sts_serial|  12|    100000|     100|0.82320320|  PASSED  
          sts_serial|  12|    100000|     100|0.64700388|  PASSED  
          sts_serial|  13|    100000|     100|0.91421216|  PASSED  
          sts_serial|  13|    100000|     100|0.71090170|  PASSED  
          sts_serial|  14|    100000|     100|0.30674023|  PASSED  
          sts_serial|  14|    100000|     100|0.67525020|  PASSED  
          sts_serial|  15|    100000|     100|0.63952330|  PASSED  
          sts_serial|  15|    100000|     100|0.55714580|  PASSED  
          sts_serial|  16|    100000|     100|0.73460968|  PASSED  
          sts_serial|  16|    100000|     100|0.69422309|  PASSED  
         rgb_bitdist|   1|    100000|     100|0.22341428|  PASSED  
         rgb_bitdist|   2|    100000|     100|0.08136192|  PASSED  
         rgb_bitdist|   3|    100000|     100|0.55014870|  PASSED  
         rgb_bitdist|   4|    100000|     100|0.14073467|  PASSED  
         rgb_bitdist|   5|    100000|     100|0.51289672|  PASSED  
         rgb_bitdist|   6|    100000|     100|0.57743763|  PASSED  
         rgb_bitdist|   7|    100000|     100|0.84468115|  PASSED  
         rgb_bitdist|   8|    100000|     100|0.91538369|  PASSED  
         rgb_bitdist|   9|    100000|     100|0.63104431|  PASSED  
         rgb_bitdist|  10|    100000|     100|0.79467241|  PASSED  
         rgb_bitdist|  11|    100000|     100|0.87835683|  PASSED  
         rgb_bitdist|  12|    100000|     100|0.31145148|  PASSED  
rgb_minimum_distance|   2|     10000|    1000|0.24538060|  PASSED  
rgb_minimum_distance|   3|     10000|    1000|0.06060245|  PASSED  
rgb_minimum_distance|   4|     10000|    1000|0.52854808|  PASSED  
rgb_minimum_distance|   5|     10000|    1000|0.24081642|  PASSED  
    rgb_permutations|   2|    100000|     100|0.79575115|  PASSED  
    rgb_permutations|   3|    100000|     100|0.97655238|  PASSED  
    rgb_permutations|   4|    100000|     100|0.72826877|  PASSED  
    rgb_permutations|   5|    100000|     100|0.47653591|  PASSED  
      rgb_lagged_sum|   0|   1000000|     100|0.88292658|  PASSED  
      rgb_lagged_sum|   1|   1000000|     100|0.83634521|  PASSED  
      rgb_lagged_sum|   2|   1000000|     100|0.05969674|  PASSED  
      rgb_lagged_sum|   3|   1000000|     100|0.49726026|  PASSED  
      rgb_lagged_sum|   4|   1000000|     100|0.99815217|   WEAK   
      rgb_lagged_sum|   5|   1000000|     100|0.60472621|  PASSED  
      rgb_lagged_sum|   6|   1000000|     100|0.57097784|  PASSED  
      rgb_lagged_sum|   7|   1000000|     100|0.80903695|  PASSED  
      rgb_lagged_sum|   8|   1000000|     100|0.14512311|  PASSED  
      rgb_lagged_sum|   9|   1000000|     100|0.91611538|  PASSED  
      rgb_lagged_sum|  10|   1000000|     100|0.92420750|  PASSED  
      rgb_lagged_sum|  11|   1000000|     100|0.60042568|  PASSED  
      rgb_lagged_sum|  12|   1000000|     100|0.13617953|  PASSED  
      rgb_lagged_sum|  13|   1000000|     100|0.24046263|  PASSED  
      rgb_lagged_sum|  14|   1000000|     100|0.92188587|  PASSED  
      rgb_lagged_sum|  15|   1000000|     100|0.28283582|  PASSED  
      rgb_lagged_sum|  16|   1000000|     100|0.93668554|  PASSED  
      rgb_lagged_sum|  17|   1000000|     100|0.84602342|  PASSED  
      rgb_lagged_sum|  18|   1000000|     100|0.47539708|  PASSED  
      rgb_lagged_sum|  19|   1000000|     100|0.91932322|  PASSED  
      rgb_lagged_sum|  20|   1000000|     100|0.22697424|  PASSED  
      rgb_lagged_sum|  21|   1000000|     100|0.86299916|  PASSED  
      rgb_lagged_sum|  22|   1000000|     100|0.44319686|  PASSED  
      rgb_lagged_sum|  23|   1000000|     100|0.49607458|  PASSED  
      rgb_lagged_sum|  24|   1000000|     100|0.64071058|  PASSED  
      rgb_lagged_sum|  25|   1000000|     100|0.67651856|  PASSED  
      rgb_lagged_sum|  26|   1000000|     100|0.05264378|  PASSED  
      rgb_lagged_sum|  27|   1000000|     100|0.52894581|  PASSED  
      rgb_lagged_sum|  28|   1000000|     100|0.23036343|  PASSED  
      rgb_lagged_sum|  29|   1000000|     100|0.08698878|  PASSED  
      rgb_lagged_sum|  30|   1000000|     100|0.91367390|  PASSED  
      rgb_lagged_sum|  31|   1000000|     100|0.50385001|  PASSED  
      rgb_lagged_sum|  32|   1000000|     100|0.39512022|  PASSED  
     rgb_kstest_test|   0|     10000|    1000|0.05304759|  PASSED  
     dab_bytedistrib|   0|  51200000|       1|0.07108892|  PASSED  
             dab_dct| 256|     50000|       1|0.06583399|  PASSED  
Preparing to run test 207.  ntuple = 0
        dab_filltree|  32|  15000000|       1|0.77425875|  PASSED  
        dab_filltree|  32|  15000000|       1|0.10287529|  PASSED  
Preparing to run test 208.  ntuple = 0
       dab_filltree2|   0|   5000000|       1|0.64344940|  PASSED  
       dab_filltree2|   1|   5000000|       1|0.13915721|  PASSED  
Preparing to run test 209.  ntuple = 0
        dab_monobit2|  12|  65000000|       1|0.55077431|  PASSED  


‘dieharder’ Conclusion

The total number of ‘dieharder’ ‘weak’ assessments was higher for /dev/urandom.