qrandom (version 1.1)

qrandomunif: Uniformly distributed sample of true random numbers

Description

qrandomunif generates uniformly distributed true random numbers in real-time by measuring the quantum fluctuations of the vacuum. Per default, the data follows a standard uniform distribution \(U(0,1)\) with minimum value \(a=0\) and maximum value \(b=1\), where both values are included.

Usage

qrandomunif(n = 1, a = 0, b = 1)

Arguments

n

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

a

Minimum value restriction for the uniform distribution (inclusive \(a\)).

b

Maximum value restriction for the uniform distribution (inclusive \(b\)).

Value

qrandomunif returns an object of class "numeric" with type "double".

The returning value of "qrandomunif" is a "vector" containing true random numbers which are uniformly distributed \(U(a,b)\).

Details

qrandomunif is based on the function qrandom to generate a sequence of a minimum of 1 and a maximum of 100,000 true random numbers. The true random numbers are generated in real-time by measuring the quantum fluctuations of the vacuum. The official QRNG@ANU JSON API currently supports only a maximum of 1,024 random numbers per request, thus requests for more numbers have to split up into smaller requests of maximum 1,024 numbers. In fact, each request may take a couple of seconds to be served. The greatest possible request qrandomunif(n = 100000) takes about 7 minutes (via DSL 16,000 internet connection) and its size is about 781.3 KB. The sequence of numbers is transformed into a uniformly distribution \(U(a,b)\), where \(a=0\) and \(b=1\) are its minimum and maximum values (both included and \(a<b\) is required).

Internally, hexadecimal numbers with block-size 7 are obtained via qrandom() and each of their first (random) character is deleted. These numbers are uniformly distributed within the range [0x0000000000000; 0xfffffffffffff] which is [0; 4,503,599,627,370,495] in decimal integers. As we already have uniformly distributed numbers, we just divide each number by the maximum possible value of 0xfffffffffffff to normalize our random numbers. After conversion into decimal numbers we obtain uniformly distributed numbers within the interval [0; 1]. Our procedure garanties, that the smallest possible number greater than zero is 2.220446e-16 and the largest possible number less than one is 0.9999999999999997779554. For further information on why these boundaries are chosen, see qrandomnorm.

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.

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

See Also

qrandomnorm

Examples

Run this code
# NOT RUN {
## request for 10 true standard uniformed random numbers
randomNumbers <- qrandomunif(n = 10)

## request for 10 true random numbers within the interval [-10; 10]
randomNumbers <- qrandomunif(n = 10, a = -10, b = 10)

## calculate mean of randomNumbers
mean(randomNumbers)
# }

Run the code above in your browser using DataCamp Workspace