arnaucube
arnaucube/comunicationLeapPublic Self-hosted repository
comunicationLeap/node_modules/shortid/lib/random/random-byte-browser.js
node_modules/shortid/lib/random/random-byte-browser.jsRaw
 1'use strict';
 2
 3var crypto = window.crypto || window.msCrypto; // IE 11 uses window.msCrypto
 4
 5function randomByte() {
 6    if (!crypto || !crypto.getRandomValues) {
 7        return Math.floor(Math.random() * 256) & 0x30;
 8    }
 9    var dest = new Uint8Array(1);
10    crypto.getRandomValues(dest);
11    return dest[0] & 0x30;
12}
13
14module.exports = randomByte;