From 26105034da4fcce7ac883c899d781f016559310d Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 8 Nov 2018 00:38:48 +0800 Subject: switch to vuepress --- node_modules/math-random/browser.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 node_modules/math-random/browser.js (limited to 'node_modules/math-random/browser.js') diff --git a/node_modules/math-random/browser.js b/node_modules/math-random/browser.js new file mode 100644 index 00000000..cde412ed --- /dev/null +++ b/node_modules/math-random/browser.js @@ -0,0 +1,17 @@ +module.exports = (function (global) { + var uint32 = 'Uint32Array' in global + var crypto = global.crypto || global.msCrypto + var rando = crypto && typeof crypto.getRandomValues === 'function' + var good = uint32 && crypto && rando + if (!good) return Math.random + + var arr = new Uint32Array(1) + var max = Math.pow(2, 32) + function random () { + crypto.getRandomValues(arr) + return arr[0] / max + } + + random.cryptographic = true + return random +})(typeof self !== 'undefined' ? self : window) -- cgit v1.2.3