Skip to content

Instantly share code, notes, and snippets.

@taizooo
Created March 25, 2012 15:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taizooo/2197231 to your computer and use it in GitHub Desktop.
Save taizooo/2197231 to your computer and use it in GitHub Desktop.
function getRandom() {
var a = [
{ 'year' : '2007'
, 'min' : 765
, 'max' : 22716604
, 'url' : 'http://kagurazakaundergroundresistance.tumblr.com/post/22716604'
},
{ 'year' : '2008'
, 'min' : 22716605
, 'max' : 67666062
, 'url' : 'http://kagurazakaundergroundresistance.tumblr.com/post/67666062'
},
{ 'year' : '2009'
, 'min' : 67666063
, 'max' : 309781568
, 'url' : 'http://kagurazakaundergroundresistance.tumblr.com/post/309781568'
},
{ 'year' : '2010'
, 'min' : 309781569
, 'max' : 2542121207
, 'url' : 'http://kagurazakaundergroundresistance.tumblr.com/post/2542121207'
},
{ 'year' : '2011'
, 'min' : 2542121208
, 'max' : 15080900593
, 'url' : 'http://kagurazakaundergroundresistance.tumblr.com/post/15080900593'
},
{ 'year' : 'now'
, 'min' : 15080900593
, 'max' : 19893333892
, 'url' : 'http://kagurazakaundergroundresistance.tumblr.com/post/19893333892'
}
]
var c = Math.floor(Math.random() * a.length);
var d = Math.floor(Math.random() * a[c].max - a[c].min + 1) + a[c].min;
console.log([d, a[c].year, a[c].max, a[c].min, c]);
return d;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment