Skip to content

Instantly share code, notes, and snippets.

@ngryman
Created October 3, 2012 23:13
Show Gist options
  • Save ngryman/3830489 to your computer and use it in GitHub Desktop.
Save ngryman/3830489 to your computer and use it in GitHub Desktop.
random seed
// the initial seed
Math.seed = 6;
// in order to work 'Math.seed' must NOT be undefined,
// so in any case, you HAVE to provide a Math.seed
Math.seededRandom = function(max, min) {
max = max || 1;
min = min || 0;
Math.seed = (Math.seed * 9301 + 49297) % 233280;
var rnd = Math.seed / 233280;
return min + rnd * (max - min);
}
@ngryman
Copy link
Author

ngryman commented Oct 3, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment