qrandom

0th

Percentile

Raw sequence of true random numbers by measuring the quantum fluctuations of the vacuum

qrandom implements an interface to the ANU Quantum Random Number Generator provided by the Australian National University. An ultra-high bandwith of true random numbers is generated in real-time by measuring the quantum fluctuations of the vacuum.

Usage
qrandom(n = 1, type = "uint8", blocksize = 1)
Arguments
n

The amount of random numbers to return. Must be between 1 and 100,000.

type

The data type must be uint8, uint16 or hex16.

blocksize

Only needed for data type hex16. Sets the length of each block and has to be between 1 and 1,024.

Details

qrandom is based on the official QRNG@ANU JSON API. The data type

  • uint8 returns uniformly distributed integers from the interval \([0; 255]\).

  • uint16 returns uniformly distributed integers from the interval \([0; 65,535]\).

  • hex16 returns uniformly distributed hexadecimal characters from the interval \([00; ff]\) for blocksize = 1.

Each request can return a minimum of 1 and a maximum of 100,000 true random numbers. The parameter blocksize is only relevant for data type hex16 and sets the length of each block. blocksize must be between 1 and 1,024. A request with data type "hex16" returns hexadecimal characters with class class character and type character. For numeric calculation with these characters randomHexCharacters, they have to be coerced e.g. with base::as.hexmode(randomHexCharacters) for smaller hexadecimal numbers, or e.g. with Rmpfr::mpfr(randomHexCharacters, base = 16) for arbitrary precision floating point numbers.

The true random numbers are generated in real-time by measuring the quantum fluctuations of the vacuum. The official QRNG@ANU JSON API supports only a maximum of 1,024 random numbers per request, thus requests for more numbers have to split up into smaller requests of 1,024 numbers. In fact, each request may take a couple of seconds to be served. The greatest possible request qrandom(n = 100000, type = "hex16", blocksize = 1024) takes about 13 minutes (via DSL 16,000 internet connection) and its size is about 201.4 MB.

At the moment, there is no limitation for the number of requests per user but if you need a huge amount of (non-live) true random numbers, there is a 10 MB, a 100 MB, a 1,000 MB and a few 5,000 MB torrents of random binary files provided for download by the ANU Quantum Random Number Generator Server here.

We try our best to provide unique true random numbers. All API requests provided by this package are using SSL. As long as nobody is able to break the encryption protocol, the random numbers you obtain should be unique and secure.

Further information can be obtained from the ANU Quantum Random Number Generator FAQ and the list of references to scientific papers.

Value

qrandom returns an object of class "integer" for data type uint8 or uint16 and an object af class "character" for data type hex16. For numeric calculations, the hexadecimal characters have to be coerced to an appropriate class prior to calculations (e.g. with base::as.hexmode or Rmpfr::mpfr).

The returning value of "qrandom" is a "vector" containing true random numbers.

References

Secure Quantum Communication group, Centre for Quantum Computing and Communication Technology, Department of Quantum Sciences, Research School of Physics and Engineering, The Australian National University, Canberra, ACT 0200, Australia. Welcome to the ANU Quantum Random Numbers Server. https://qrng.anu.edu.au/index.php

Aliases
  • qrandom
Examples
# NOT RUN {
## request for 10 true random numbers within the interval [0; 255]
randomNumbers <- qrandom(n = 10)

## request for 10 true random numbers within the interval [0; 65,535]
randomNumbers <- qrandom(n = 10, type = "uint16")

## request for 10 true random hexadecimal characters within the interval [00; ff]
randomNumbers <- qrandom(n = 10, type = "hex16")

## requests with data type 'hex16' are characters
class(randomNumbers)
typeof(randomNumbers)

## request for 10 true random hexadecimal numbers within the interval [0000; ffff]
randomNumbers <- qrandom(n = 10, type = "hex16", blocksize = 2)

## coerce hexadecimal random characters to hexadecimal numbers prior to numeric calculations
## calculate mean of randomNumbers
library(Rmpfr)
mean(as.hexmode(randomNumbers))
mean(mpfr(randomNumbers, base = 16))
# }
Documentation reproduced from package qrandom, version 1.0, License: GPL-2 | file LICENSE

Community examples

Looks like there are no examples yet.