rbyte {rmonocypher} | R Documentation |
Generate random bytes from the platform-specific cryptographically secure pseudorandom number generator
Description
Generate random bytes from the platform-specific cryptographically secure pseudorandom number generator
Usage
rbyte(n, type = "chr")
Arguments
n |
Number of random bytes to generate. Note: if the entropy pool is exhausted on your system it may not be able to provide the requested number of bytes - in this case an error is thrown. |
type |
Type of returned values - 'raw' or "chr". Default: "chr". |
Value
A raw vector or a hexadecimal string
Platform notes
The method used for generating random values varies depending on the operating system (OS):
For macOS and BSDs:
arc4random_buf()
For linux:
syscall(SYS_getrandom())
For win32:
BCryptGenRandom()
All these random number generators are internally seeded by the OS using entropy gathered from multiple sources and are considered cryptographically secure.
Examples
rbyte(16, type = "chr")
rbyte(16, type = 'raw')
[Package rmonocypher version 0.1.8 Index]