Chris Alexander

On Engineering

Get random numbers with jQuery

9th March, 2013

I often make comedy of the thousands of StackOverflow questions along the lines of “How do I add to an array with jQuery?” and so on. Well, I was working with some Chrome Apps I’m putting together and needed some random numbers. So obviously I wrote a jQuery plugin to do it.

Obviously I am well aware of Math.random(), but you can use the API on to get random numbers generated through atmospheric noise measurements. So to build a bit of a proof-of-concept of adapting features for offline and online use, I built a jQuery plugin that uses the API when online, and falls back to Math.random() when offline.

The plugin is hosted over on github, you can view the readme for all of the documentation.

(No alt specified)