| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/utils.R |
| 3 |
\name{random} |
| 4 |
\alias{random} |
| 5 |
\title{Random Data Generation} |
| 6 |
\usage{ |
| 7 |
random(n = 1L, convert = TRUE) |
| 8 |
} |
| 9 |
\arguments{ |
| 10 |
\item{n}{[default 1L] integer random bytes to generate (from 0 to 1024), |
| 11 |
coerced to integer if required. If a vector, the first element is taken.} |
| 12 |
|
| 13 |
\item{convert}{[default TRUE] logical \code{FALSE} to return a raw vector, or |
| 14 |
\code{TRUE} to return the hex representation of the bytes as a character string.} |
| 15 |
} |
| 16 |
\value{ |
| 17 |
A length \code{n} raw vector, or length one vector of \verb{2n} random |
| 18 |
characters, depending on the value of \code{convert} supplied. |
| 19 |
} |
| 20 |
\description{ |
| 21 |
Strictly not for use in statistical analysis. Non-reproducible and with |
| 22 |
unknown statistical properties. Provides an alternative source of randomness |
| 23 |
from the Mbed TLS library for purposes such as cryptographic key generation. |
| 24 |
Mbed TLS uses a block-cipher in counter mode operation, as defined in |
| 25 |
NIST SP800-90A: \emph{Recommendation for Random Number Generation Using |
| 26 |
Deterministic Random Bit Generators}. The implementation uses AES-256 as the |
| 27 |
underlying block cipher, with a derivation function, and an entropy collector |
| 28 |
combining entropy from multiple sources including at least one strong entropy |
| 29 |
source. |
| 30 |
} |
| 31 |
\note{ |
| 32 |
Results obtained are independent of and do not alter the state of R's |
| 33 |
own pseudo-random number generators. |
| 34 |
} |
| 35 |
\examples{ |
| 36 |
random() |
| 37 |
random(8L) |
| 38 |
random(n = 8L, convert = FALSE) |
| 39 |
|
| 40 |
} |