Skip to main content
https://travis-ci.org/YavorPaunov/asyncrandom.svg?branch=master

Asyncrandom

Utility for fetching one or more random numbers from the ANU Quantum Random Numbers Server by calling the endpoint at https://qrng.anu.edu.au/API/jsonI.php. Requests are executed asynchronously using the tornado networking framework.

More information about how the numbers are generated can be found on https://qrng.anu.edu.au/.

Requires tornado and its IOLoop to run.

Installation

Download the source and run the setup file:

python setup.py install

Usage

A simple example of generating a single random uint8:

def handle_random_int(f):
    print(f.result())

f = asyncrandom.fetch()
f.add_done_callback(handle_random_int)

tornado.ioloop.IOLoop.current()

Multiple numbers can be generated as well. In this example we generate 10:

def handle_random_int(f):
    print(f.result())

f = asyncrandom.fetch(10)
f.add_done_callback(handle_random_int)

tornado.ioloop.IOLoop.current().start()

By default, 8-bit unsigned integers are generated. Optionally, this can be changed to 16-bit. Example of generating 10 16-bit integers:

def handle_random_int(f):
    print(f.result())

f = asyncrandom.fetch(10, asyncrandom.IntegerType.UINT16)
f.add_done_callback(handle_random_int)

tornado.ioloop.IOLoop.current()

If called from the command, issues a synchronous call to the service. Optionally, --length and --type can be specified as arguments, with default values of 1 and "uint-8" respectively.

Command line example:

$ asyncrandom --int-type=uint8 --length=1
105

Metadata

Release files for asyncrandom 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for asyncrandom 0.0.1
File Size Uploaded
asyncrandom-0.0.1.tar.gz 3.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for asyncrandom 0.0.1
File Interpreter ABI Platform
asyncrandom-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 8.5 kB

Release files / asyncrandom-0.0.1.tar.gz

Download URL asyncrandom-0.0.1.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
79e44e1066744a8e91a2d784218ecef14bc484ed40734e2d9680d4633e0a26fc
BLAKE2b-256 checksum
How to use checksums
6714f4fa3b7a3d1fbef2383901f69159ae1769cd195d5ec0f87c1a1b9fdc0ccb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / asyncrandom-0.0.1-py3-none-any.whl

Download URL asyncrandom-0.0.1-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f9338a1d2d103714567abdcfe7e158922b75333a348dde8b59aedf29dd293918
BLAKE2b-256 checksum
How to use checksums
0d6ab06eef52aaa0eede5be6920a765ab0858806f59f9b96156a340f1a8f0cd0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page