random {random}R Documentation

True random numbers from random.org

Description

The random packages provides several functions that access the true random number service at http://random.org.

randomNumber retrieves random integers with duplicates, randomSequence retrieves random sequences without duplicates, randomBytes retrieves raw bytes and randomBufferStatus retrieves the status of the service, and sufficientBits returns a logical value indicating whether the service has random bits in excess of a threshold value.

Usage

   randomNumbers(n=100, min=1, max=100, col=5, check=TRUE)
   randomSequence(min=1, max=20, check=TRUE)
   randomBytes(n=16, format=c("hex","dec","oct","bin"), check=TRUE)
   randomBufferStatus()
   sufficientBits()

Arguments

n The number of random integers, or bytes, to be retrieved.
min The minimum value for the returned numbers.
max The maximum value for the returned numbers.
col The number of columns for the return object.
check Boolean whether buffer size at server should be tested.
format The desired format for the raw bytes.

Details

The http://random.org services uses atmospheric noise sample via a radio tuned to an unused broadcast frequency together with a skew correction originally due to John von Neumann. Please see the included vignette for more details.

Value

Each function returns a data.frame. For randomNumbers, it contains col columns of a total of n integers between min and max, possibly containing duplicates. For randomSequence, it contains the shuffled sequence denoted by min and max. For randomBytes, n raw bytes in the selected format are returned. Lastly, randomBufferStatus returns the status of the service as a percentage. sufficientBits is a simple convenience wrapper which tests whether the return from randomBufferStatus() is at least 0.2 in value.

Author(s)

Dirk Eddelbuettel edd@debian.org for the R interface; Mads Haahr for random.org.

References

The random.org website at http://www.random.org. Also see the included vignette for further references.

Examples

  ## Cannot run these as we may not have an internet connection
  ## Not run: 
    rn <- randomNumbers(100, 1, 100, 5)
    rs <- randomSequence(1, 20)
  
## End(Not run)

[Package random version 0.1.0 Index]