Created
November 14, 2015 14:28
-
-
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)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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