Skip to content

Instantly share code, notes, and snippets.

@wrzlbrmft
Created November 14, 2015 14:28
Show Gist options
  • Save wrzlbrmft/40a10465a5e2504ac88b to your computer and use it in GitHub Desktop.
Save wrzlbrmft/40a10465a5e2504ac88b to your computer and use it in GitHub Desktop.
Re: Random numbers: Ads may not include code that generates or uses random numbers. (Google)
var PseudoRandom = PseudoRandom || {};
PseudoRandom.seed = 12345 * (12345 + new Date().getMilliseconds());
PseudoRandom.random = function() {
this.seed = parseInt(("" + (12345 * this.seed)).substr(0, 13));
return parseFloat("0." + ("" + this.seed).split("").reverse().join(""));
};
// Example
for (var i = 0; i < 10; i++) {
document.write(PseudoRandom.random() + "<br />");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment