Check out my
new book!
HTML5 Games book
AppJet + Random.org = True JSON randomness Oi, I've been busy for the past week, mostly with doing nothing at all and just enjoying the tail end of the summer. Got some good ideas I need to put some work in now but for now here's another small app I made while messing around with AppJet a few weeks ago.

It's a simple JS gateway to the true random number generator at Random.org (created by Mads Haahr). It accesses the Random.org API, retrieves a number of random integers (maximum of 100 numbers), turns the response into JSON data and calls a callback function specified by you.

Example usage:


<script>
function randomcallback(res) {
alert( "A random number between 1 and 100: " + res.numbers[0] );
}
</script>

<script src="http://json-random.appjet.net/?num=1&min=1&max=100&callback=randomcallback" />


I'm not sure if I'll ever have a use case where a pseudo-random Math.random() call won't do, but usefulness is not really my game anyway..

Check out the application and source here: http://json-random.appjet.net/
⇓ 0 comments
Post a Comment