Randomness has been useful to society for thousands of years, but has become essential in the modern age. Applications range from games of chance, religious ritual, and lottery systems, to the cryptographic techniques that allow us to use the internet with any degree of privacy.
The following is a simple script that demonstrates NISTs randomness beacon.
#!/usr/bin/env bash
# nist-randomness-beacon-eg.sh
# --------------------------------------------------------------------------------
#
# Output:
# Datetime: 2022-10-06T11:58:07
# Previous: 29B7969259B18...
# Current: 97B0CAC685FD4...
#
# Resources:
# - https://beacon.nist.gov/home
# - https://csrc.nist.gov/projects/interoperable-randomness-beacons
# Print datetime
printf "%s\n" "Datetime: $(date +'%FT%H:%M:%S')"
# Get some randomness
# Prints only the current and previous values
# Execute a few times around 58-04s to witness the pulse iterate the values
curl -s https://beacon.nist.gov/beacon/2.0/pulse/last | jq -r '"Previous: \(.pulse.listValues[] | select(.type=="previous") | .value) \n Current: \(.pulse.outputValue)"'