diff --git a/browser.js b/browser.js index a143a70..11cb609 100644 --- a/browser.js +++ b/browser.js @@ -47,7 +47,7 @@ not, since the functions are different and does not convert using browserify */ function randomBytes(size) { var arr = new Uint8Array(size); - if (typeof window === 'undefined') { + if (typeof browserCrypto.getRandomValues === 'undefined') { return Buffer.from(nodeCrypto.randomBytes(size)); } else { browserCrypto.getRandomValues(arr);