Created
January 9, 2018 11:09
-
-
Save ben182/0ea68c391f2d3a51de10b484d92d4244 to your computer and use it in GitHub Desktop.
Better Math.random
This file contains hidden or 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
| (function () { | |
| var MathRandom = Math.random; | |
| Math.random = function() { | |
| var crypto = window.crypto || window.msCrypto; | |
| if (crypto !== undefined) { | |
| return crypto.getRandomValues(new Uint32Array(1))[0] / 4294967296; | |
| } | |
| return MathRandom(); | |
| } | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment