Random generator via atmospheric noise random.org
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
doc Fixed readme, fixed travis Oct 29, 2014
src/randomorg Tests are done Nov 6, 2014
test/randomorg Fixed keyword Nov 6, 2014
.gitignore Emacs gitignore Oct 27, 2014
.travis.yml Kibit checks fixed Nov 3, 2014
LICENSE Initial commit Oct 25, 2014
README.md Readme upd Nov 7, 2014
project.clj Kibit checks fixed Nov 3, 2014



Build Status Dependencies Status

Random generator via atmospheric noise random.org

[randomorg "0.1.0"]


Are your random numbers really random?


;; generate two 6-sided dice rolls
(generate-integers :n 2 :min 1 :max 6)

;; shuffle 52-card deck
(generate-integers :n 52 :min 1 :max 52 :replacement false)

;; uniform distribution of 10 numbers in [0, 1]
(generate-decimal-fractions :n 10 :digits 2)

;; normal distribution
(generate-gaussians :n 10 :mean 0 :std 10 :digits 2)

;; new password alphanumeric 12 chars
(generate-strings :n 1 :length 12 :characters (str lowercase uppercase digits))

;; three UUIDs
(generate-uuids :n 3)

;; 1Kb of random garbage
(generate-blobs :n 1 :size (* 8 1024) :format "hex")

All request are made with default API key, which is shared. Request your own API key for production purposes.

(binding [*API_KEY* "your-api-key"]
  (generate-integers :n 10 :min 0 :max 99))

Digital Signing

Random.org provides signed version of its API. Just add an optional parameter :signed true

(generate-uuids :n 1 :signed true)

Response map contains additional object :signed

{:signed {:random { <random data> }
          :signature "SHA512-json-random"}}

Using this object you can validate that results are really random and comes from random.org. Encode random object to json, compute SHA-512 and verify against signature. Also, you can use random.org api call for that.

(verify-signature {:random { <random data> }
                   :signature "SHA512-json-random"})

Remaining quota

Every succesful response return :usage object as well

{:requests-left 4978
 :bits-left     482078}

Besides, you can request quota without data


It includes total usage of API_KEY as well.

{:requests-left   4978
 :bits-left       482078
 :total-bits      26347262
 :total-requests  237}


To avoid wasteful calls with invalid params to server, we use bouncer validation library. It contains plenty checks if all required parameters specified, values in a allowed range, etc.

If validation error occurs, error object returned

{:status :error :message "n must be provided"}


Currently all tests are dumb - they validate that request is actually sent to random.org and response is returned. There are no validation of content obtained from random.org. Tests are powered by midje

lein midje

Static Analysis

  • lein eastwood
  • lein kibit


Distributed under the Eclipse Public License.