Skip to content

Julia module with functions to provide support for obtaining random numbers generated by the RANDOM.ORG website using their API.

License

Notifications You must be signed in to change notification settings

edwcarney/RandomDotOrgAPI.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RandomDotOrgAPI.jl

Julia module with functions to provide support for obtaining random numbers generated by the RANDOM.ORG (RDO) website using the API. (See this link for information on obtaining an API key and some advantages of using the API.) The code is set up to use the 'basic' (unsigned) setting as default and an API key of all zeros. In order to include your own API key in calls for "signed" responses and for get_usage(), you should pass this key as the argument apiKey=myapiKey.

# substitute your API key from Random.org
myapiKey = "00000000-0000-0000-0000-000000000000"

Functions to obtain random numbers from Random.org using HTTP instead of the API are available in the following repository: https://github.com/edwcarney/RandomDotOrg.jl

From the RANDOM.ORG FAQ (Q4.1):

The RANDOM.ORG setup uses an array of radios that pick up atmospheric noise. Each radio generates approximately 12,000 bits per second. The random bits produced by the radios are used as the raw material for all the different generators you see on RANDOM.ORG. Each time you use one of the generators, you spend some bits. By enforcing a limit on the number of bits you can use per day, the quota system prevents any one person from hogging all the numbers. (Believe us, this was a big problem before we implemented the quota system.)

Current functions

get_usage()—obtain current bit quota for your IP
check_usage()—check if quota is non-zero.
get_result()—get a stored signed result from RDO (stored >= 24 hours)
verify_signature()—obtain signature verification for a previously signed result from RDO
generate_integers()—obtain integers
generate_integer_sequences()—obtain randomized sequences of integers 1..N
generate_strings()—obtain random strings of characters (upper/lower case letters, digits)
generate_gaussians()—obtain random Gaussian numbers
generate_decimal_fractions()—obtain random numbers on the interval (0,1)
generate_uuids()—obtain random bytes in various formats
generate_blobs()—generate bit blobs of sizes in multiples of 8 in base64 or hex
pull_data()—extract data from RDO response (RDO returns Julia Dictionary)

Simply include the file with include("RandomDotOrgAPI.jl"). You may also install the module from GitHub using
Pkg.add(url="https://github.com/edwcarney/RandomDotOrgAPI.jl") in the Julia REPL
or use add "https://github.com/edwcarney/RandomDotOrgAPI.jl" in the Pkg REPL

Values are returned in a Julia dictionary. Use the pull_data function to extract random values.

The use of secure HTTP by RANDOM.ORG prevents interception while the numbers are in transit. However, it is probably best not to use the Random.org site for any purpose that might have a direct impact on security. The FAQ (Q2.4) on the website says the following: "We should probably note that while fetching the numbers via secure HTTP would protect them from being observed while in transit, anyone genuinely concerned with security should not trust anyone else (including RANDOM.ORG) to generate their cryptographic keys."

using HTTP, JSON

About

Julia module with functions to provide support for obtaining random numbers generated by the RANDOM.ORG website using their API.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages