ANU-Web-Quantum-RNG
1 Basic Generation
awqrng-u8
awqrng-u16
awqrng-hex16
awqrng-clear-cache
2 Fetching
awqrng-fetch-u8
awqrng-fetch-u16
awqrng-fetch-hex16
7.4

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-u8)  fixnum?

Returns a random 8-bits unsigned number.

Examples:
> (awqrng-u8)

51

> (awqrng-u8)

159

> (awqrng-u8)

77

procedure

(awqrng-u16)  fixnum?

Returns a random 16-bits unsigned number.

Examples:
> (awqrng-u16)

39299

> (awqrng-u16)

58914

> (awqrng-u16)

4026

procedure

(awqrng-hex16)  string?

Returns a random 16-bits hexadecimal number as a string.

Examples:
> (awqrng-hex16)

"43cc"

> (awqrng-hex16)

"8ac5"

> (awqrng-hex16)

"612a"

procedure

(awqrng-clear-cache)  void?

Clear the cache.

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?
Return a list of length random 8-bits integers.

Example:
> (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?
Return a list of length random 16-bits integers.

Example:
> (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?
Return a list of length strings, each string representing size random 16-bits hexadecimal numbers.

Examples:
> (awqrng-fetch-hex16 4 5)

'("f776f5cc9d" "f987d203ad" "8ad36a9517" "58744e09fa")

> (awqrng-fetch-hex16 5 10)

'("782278ce43c8598c0ceb"

  "733d4e5aafebbf690c1f"

  "d10af473c98de0601e07"

  "33548b255c1adb3d64a3"

  "80f342093b4ab24dcada")