random
package 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 and randomStrings
retrieves strings.
randomQuota
returns the number of available retrievals, and
quotaCheck
does a simple binary comparison of remaining numbers
under the quota.
randomNumbers(n=100, min=1, max=100, col=5, base=10, check=TRUE) randomSequence(min=1, max=20, col=1, check=TRUE) randomStrings(n=10, len=5, digits=TRUE, upperalpha=TRUE, loweralpha=TRUE, unique=TRUE, check=TRUE) randomQuota() quotaCheck()
matrix
.
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
randomStrings
, n
strings of length len
are returned.randomQuota
returns the number of bits remaining for retrieval
at the given day under the currently used IP address.
quotaCheck
is a simple convenience wrapper which tests
whether the return from randomBufferStatus()
is a positive number.
vignette
for more details.
random.org
website at http://www.random.org.
Also see the included vignette for further references.
## 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)
Run the code above in your browser using DataCamp Workspace