Last active
August 29, 2015 13:57
-
-
Save larchanka/bab3ca8e06081ccad8f2 to your computer and use it in GitHub Desktop.
Yet Another Random
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 YAR = function(nseed) { | |
var seed, constant = Math.pow(2, 13) + 1, | |
prime = 37, | |
maximum = Math.pow(2, 50); | |
if (nseed) { | |
seed = nseed; | |
} | |
if (seed == null) { | |
seed = (new Date()).getTime(); | |
} | |
return { | |
next: function() { | |
seed *= constant; | |
seed += prime; | |
seed %= maximum; | |
return seed; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to use: