We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents a372928 + 9531b6a commit 0304f1dCopy full SHA for 0304f1d
1 file changed
index.js
@@ -81,18 +81,18 @@ function factory(prng) {
81
82
/* istanbul ignore next */
83
function _prng(root) {
84
+ var crypto = root && (root.crypto || root.msCrypto)
85
- if (root) {
86
+ if (crypto) {
87
try {
- var crypto = root.crypto || root.msCrypto
88
return function() {
89
return crypto.getRandomValues(new Uint16Array(1))[0] / 0xFFFF
90
}
91
92
catch (e) {}
93
} else {
94
95
- var crypto = require("crypto")
+ crypto = require("crypto")
96
97
return crypto.randomBytes(2).readUInt16LE() / 0xFFFF
98
0 commit comments