ANU-Web-Quantum-RNG
Tetsumi <testumi@protonmail.com>
(require ANU-Web-Quantum-RNG) | |
package: ANU-Web-Quantum-RNG |
This package provides an implementation to fetch true random numbers from the quantum random number generator of the Australian National University (QRNG@ANU).
For a description of the QRNG@ANU JSON API, go to https://qrng.anu.edu.au/API/api-demo.php.
1 Basic Generation
The following procedures are relying on a cache holding at most 1024 16-bits unsigned integers. When the cache is empty, it’s automatically refilled by fecthing 1024 numbers from QRNG@ANU.
procedure
(awqrng-u16) → fixnum?
> (awqrng-u16) 39299
> (awqrng-u16) 58914
> (awqrng-u16) 4026
procedure
(awqrng-hex16) → string?
> (awqrng-hex16) "43cc"
> (awqrng-hex16) "8ac5"
> (awqrng-hex16) "612a"
procedure
2 Fetching
The following procedures bypass the cache to directly fetch numbers from QRNG@ANU.
procedure
(awqrng-fetch-u8 length) → (listof fixnum?)
length : exact-nonnegative-integer?
> (awqrng-fetch-u8 10) '(86 49 232 168 205 223 7 61 27 38)
procedure
(awqrng-fetch-u16 length) → (listof fixnum?)
length : exact-nonnegative-integer?
> (awqrng-fetch-u16 10) '(22577 48657 55574 39258 57038 2908 48371 25155 13422 51159)
procedure
(awqrng-fetch-hex16 length size) → (listof string?)
length : exact-nonnegative-integer? size : exact-nonnegative-integer?
> (awqrng-fetch-hex16 4 5) '("f776f5cc9d" "f987d203ad" "8ad36a9517" "58744e09fa")
> (awqrng-fetch-hex16 5 10)
'("782278ce43c8598c0ceb"
"733d4e5aafebbf690c1f"
"d10af473c98de0601e07"
"33548b255c1adb3d64a3"
"80f342093b4ab24dcada")