Skip to content

Instantly share code, notes, and snippets.

@nfroidure
Created June 3, 2013 11:10
Show Gist options
  • Save nfroidure/5697488 to your computer and use it in GitHub Desktop.
Save nfroidure/5697488 to your computer and use it in GitHub Desktop.
Getting Math.random a bit more random
Math.random=(function(rand) {
var salt=0;
document.addEventListener('mousemove',function(event) {
salt=event.pageX*event.pageY;
});
return function() { return (rand()+(1/(1+salt)))%1; };
})(Math.random);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment