dieharder: Random numebr generator test suite

Description Usage Arguments Details Value Author(s) References Examples

View source: R/dieharder.R

Description

The random package provides an interface to the dieharder suite of random number generators.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
   ## Default S3 method:
dieharder(rng="mt19937", test="diehard_runs", psamples=100,
                               seed=0, verbose=FALSE, inputfile="", ntuple=5) 
   ## S3 method for class 'dieharder'
print(x, ...)
   ## S3 method for class 'dieharder'
summary(object, ...)
   ## S3 method for class 'dieharder'
plot(x, ...)
   dieharderGenerators()
   dieharderTests()

Arguments

rng

Either a single character vector, or an integer index, selecting a random-number generator to be tested.

test

Either a single character vector, or an integer index, selecting a dieharder test to be used.

psamples

An integer for the number of probability values samples underlying the main Kolomogorov-Smirnov test.

seed

An integer seed that is to be used for the dieharder rng; if 0, a new random seed is generated.

verbose

A switch selecting verbose or silent operation.

inputfile

File to read rng draws from for the file_input and file_input_raw generators.

ntuple

A integer selecting the ntuple length for tests on short bit strings that permit varying length such as RGB bitdist.

x

A dieharder object.

object

A dieharder object.

...

Other arguments passed on.

Details

The current list of generators can be generated dynamically using the dieharderGenerators() function. Entries with id below 200 are from the GNU Scientific Library, entries with id greater or equal to 200 and less than 400 are from Dieharder itself, entries with id greater or equal to 400 and less than 500 are from GNU R, entries with id greater or equal to 500 and less than 600 are hardware-based (which is system-dependent), and entries with id greater or equal to 600 are user-contributed.

The current list of tests can be generated dynamicall using the dieharderTests() function.

Value

An object of class dieharder, which inherits from the class htest commonly used for test statistics is returned. It contains the members

p.value

for the (Kuiper variant) of the Kolmogorov-Smirnov test of the null of a uniform distribution of test values generated by psamples tests of test using draws from rng

data

the vector of test statistics used for the Kolmogorov-Smirnov test

method

the test method as returned by the dieharder library

data.name

a character vector describing the data

generator

a text desciption of the generator as returned by the dieharder library

Author(s)

Dirk Eddelbuettel edd@debian.org for the R interface and the port of the R RNGs to DieHarder; Robert G. Brown for everything else in dieharder.

References

The dieharder source code and website at http://www.phy.duke.edu/~rgb/General/dieharder.php.

Examples

1
2
3
4
5
6
  ## need to set this for the example to pass the R CMD check test
  .dieharder.generators <<- dieharderGenerators()
  dh <- dieharder(41, 15, seed=12345) # randu and diehard_runs
  dh
  summary(dh)
  plot(dh)

Example output

	Diehard Runs Test

data:  Created by RNG `randu' with seed=12345, sample of size 100
p-value = 0.07431


	Diehard Runs Test

data:  Created by RNG `randu' with seed=12345, sample of size 100
p-value = 0.07431


Summary for test data
    Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
0.001139 0.151718 0.376357 0.429477 0.711617 0.987953 


Stem and leaf plot for test data

  The decimal point is 1 digit(s) to the left of the |

  0 | 0011112344555577789
  1 | 012355568
  2 | 112223447889
  3 | 01345556778
  4 | 0023789
  5 | 235567899
  6 | 4455679
  7 | 03444666689
  8 | 00123357
  9 | 0356669

NULL

	One-sample Kolmogorov-Smirnov test

data:  object$data
D = 0.13181, p-value = 0.05638
alternative hypothesis: two-sided


	Wilcoxon signed rank test with continuity correction

data:  object$data
V = 1856, p-value = 0.02153
alternative hypothesis: true location is not equal to 0.5

RDieHarder documentation built on Dec. 7, 2019, 9:07 a.m.