{"id":15293340,"url":"https://github.com/alephtwo/quantum_rng","last_synced_at":"2025-10-07T06:30:37.864Z","repository":{"id":28815083,"uuid":"32338284","full_name":"alephtwo/quantum_rng","owner":"alephtwo","description":"A Ruby interface for the ANU Quantum Random Numbers API","archived":true,"fork":false,"pushed_at":"2021-10-06T03:32:25.000Z","size":12,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-10T14:26:58.996Z","etag":null,"topics":["json-api","random-number-generators","ruby"],"latest_commit_sha":null,"homepage":"https://rubygems.org/gems/quantum_rng","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alephtwo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-03-16T16:31:46.000Z","updated_at":"2023-05-16T22:45:37.000Z","dependencies_parsed_at":"2022-09-05T02:21:52.295Z","dependency_job_id":null,"html_url":"https://github.com/alephtwo/quantum_rng","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alephtwo%2Fquantum_rng","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alephtwo%2Fquantum_rng/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alephtwo%2Fquantum_rng/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alephtwo%2Fquantum_rng/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alephtwo","download_url":"https://codeload.github.com/alephtwo/quantum_rng/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235599626,"owners_count":19016190,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["json-api","random-number-generators","ruby"],"created_at":"2024-09-30T16:46:22.509Z","updated_at":"2025-10-07T06:30:37.513Z","avatar_url":"https://github.com/alephtwo.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# QuantumRNG\nA Ruby gem that leverages the [ANU Quantum Random Numbers Server API](http://qrng.anu.edu.au/index.php).\n\n# Acknowledgements\nThis gem exists entirely as an interface to the ANU Quantum Random Numbers API. **All of the heavy lifting is done on their side, and any credit belongs entirely to them.** I have just generalized access to the JSON API.\nPlease give them a visit: [http://photonics.anu.edu.au/qoptics/Research/qrng.php](http://photonics.anu.edu.au/qoptics/Research/qrng.php)\n\n### So, you want random numbers...\nComputers are great at creating pseudorandom numbers, but true randomness requires a little bit more effort.\n\nThat's where the fine folks at the [ANU Quantum Random Numbers Server](http://qrng.anu.edu.au/index.php) come in. They've provided a handy JSON API for accessing what they guess are truly random numbers. You can read more about the science behind this and why they believe they've achieved true randomness at their site.\n\n## Installation\n```\ngem install quantum_rng\n```\n\nIf you're using Bundler, include the gem in your `Gemfile`:\n```\ngem 'quantum_rng'\n```\n\n## Usage\n\n| Method | Argument(s)               | Description                                     |\n| ------ | :-----------------------: | ----------------------------------------------- |\n| uint8  | `count = 1`               | `count` integers between 0 and 255              |\n| uint16 | `count = 1`               | `count` integers between 0 and 65535            |\n| hex16  | `block_size`, `count = 1` | `count` hex numbers of `block_size` bytes       |\n| random | `count = 1`               | `count` real numbers between 0 and 1, inclusive |\n| int    | `max`, `count = 1`        | `count` integers in the range `[0, max)`        |\n| float  | `max`, `count = 1`        | `count` real numbers in the range `[0, max)`    |\n\nEvery method returns an array of numbers.\n\n## Errors\n* If you are unable to connect to the ANU RNG server for any reason, this gem will default to similar interactions using `SecureRandom`. In future versions, this will be allowed as a configuration option.\n* Requesting too many numbers (usually where `count \u003e 1025`) or passing invalid arguments will likely cause a RuntimeError. In future versions, this behavior will be softened.\n\n## Examples\n```ruby\n  # A single random uint8\n  QuantumRNG.uint8\n  # 5 random uint8\n  QuantumRNG.uint8(5)\n\n  # A single random uint16\n  QuantumRNG.uint16\n  # 5 random uint16\n  QuantumRNG.uint16(5)\n\n  # A single 1-byte hex number\n  QuantumRNG.hex16(1)\n  # 5 random 1-byte hex numbers\n  QuantumRNG.hex16(1, 5)\n\n  # A single random between 0 and 1, inclusive\n  QuantumRNG.random\n  # 5 randoms between 0 and 1, inclusive\n  QuantumRNG.random(5)\n\n  # A single random int less than 100\n  QuantumRNG.int(100)\n  # 5 ints less than 100\n  QuantumRNG.int(100, 5)\n\n  # A single random float less than 100\n  QuantumRNG.float(100)\n  # 5 random floats less than 100\n  QuantumRNG.float(100, 5)\n```\n\n# TODO\nFuture versions will include better error handling.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falephtwo%2Fquantum_rng","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falephtwo%2Fquantum_rng","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falephtwo%2Fquantum_rng/lists"}