Certified Random

What?

Certified Random was a service that provided crowdsourced random numbers, rolled by physical die roll.

It's a fairly well-known fact that computer-generated random numbers are generally not truly random. Randall Munroe, in his comic xkcd, pokes fun at computers and randomness in general (the comic in which he does so is linked below).

But he also got me thinking - what if we could collect all the results of all the dice rolled everywhere in the world? What if we could actually create a function where the resulting random number was rolled by a person, with a physical die?

Unfortunately, there was too little use for Certified Random, and it is now defunct. This site, and the github repositories are all that remain.

xkcd - Random Number

Random Number Chosen by Fair Dice Roll

Really?

Well, no, not really.

I expect this service to be used in ways in which it was not intended. Despite the name, numbers are not actually certified, as there is no way to actually verify that the results are rolled with physical dice.

In any case, it's fun. And if people are genuine about it, it might even be useful.

And Who Are You?

I'm Ryan. I like JavaScript, and that's a large portion of what I've used to create this service.

I do some other things as well like Text Message Marketing and Professional Education. I'm also a gamer, and a giant nerd.

Really, I'm just trying to learn as much as I can while being a decent person.

Technology

Here's some of the stuff I've used to create Certified Random

  • NodeJS
  • MongoDB/Mongolab
  • ExpressJS
  • Mocha
  • Sublime Text
  • Heroku

CR-API

It's a really simple REST API. Below are the endpoints, required fields, and sample responses.

GET /roll?type={dieType}

Gets a random roll of type {dieType}, and marks that roll as used

Valid types are 2, 4, 6, 8, 10, 12, 20, 30 and any power of 10 greater than 0 (10, 100, 1000, 10000, etc.)

Sample Response:

{
  "meta": {
    "success": true
  },
  "links": {
    "self": "/roll/0192834601ty2341234"
    "another": "/roll?type=4"
  },
  "roll": {
    "type": 4,
    "value": 3,
    "certified": true,
    "dateAdded": 1399468224621,
    "used": false,
    "id": "0192834601ty2341234"
  }
}

GET /roll/{id}

Gets the roll with ID = {id}

The intent here is to check on a specific roll (perhaps one you added yourself), whether it is used or not.

Sample Response:

{
  "meta": {
    "success": true
  },
  "links": {
    "self": "/roll/0192834601ty2341234"
  },
  "roll": {
    "type": 4,
    "value": 3,
    "certified": true,
    "dateAdded": 1399468224621,
    "used": true,
    "id": "0192834601ty2341234"
  }
}

POST /roll

Creates a new certified roll.

The roll data should be in the request body. JSON or form-encoded data will work, and there are three required fields:

type (integer)
The type of die you rolled. Valid types are 2, 4, 6, 8, 10, 12, 20, 30 and any power of 10 greater than 0 (10, 100, 1000, 10000, etc.)
value (integer)
The number that came up on the die. It must be at least 1 and no more than the value of the die.
certified (boolean)
Confirmation that this request is the result of a physical die roll. This must be true for the request to be accepted.

Sample Request Body:

{"type": 6, "value": 2, "certified": true}

Sample Response:

{
  "meta": {
    "success": true
  },
  "links": {
    "self": "/roll/p19823nhrfdobnasdf"
  },
  "roll": {
    "type": 6,
    "value": 2,
    "certified": true,
    "dateAdded": 1399468224621,
    "used": false,
    "id": "1p902o4irnfpa9osdf"
  }
}

GET /stats[/{type}]

Retreives statistics for all types of roll. This includes the number or rolls (total and per type), unused rolls (total and per type), and used rolls (total and per type). Types that have no rolls are not returned at all.

If {type} is provided, statistics are retrieved for only that type of roll. If there are no rolls for the specified type, all statistics returned will be 0.

Sample Response:

{
  "meta": {
    "success": true
  },
  "links": {
    "self": "/stats"
  },
  "stats": {
    "2": {
      "total": 9,
      "used": 2,
      "unused": 7
    },
    "4": {
      "total": 2,
      "used": 0,
      "unused": 2
    },
    "6": {
      "total": 24,
      "used": 5,
      "unused": 19
    },
    "all": {
      "total": 55,
      "used": 17,
      "unused": 38
    }
  }
}
close

Your Last 20 Rolls

That were added from this device.

You can always click "My Rolls" in the nav bar to see the list.

ID Added On (day/month/year) Type Value Used? Used On (day/month/year)

You haven't added any rolls!

Get on that.