lib/crypto/crypto-engine.js
function safeRandom(len) {
    var randomBytes = new Uint8Array(len);
    while (len > 0) {
        var segmentSize = len % maxRandomQuota;
        segmentSize = segmentSize > 0 ? segmentSize : maxRandomQuota;
        var randomBytesSegment = new Uint8Array(segmentSize);
        webCrypto.getRandomValues(randomBytesSegment);
        len -= segmentSize;
        randomBytes.set(randomBytesSegment, len);
    }
    return randomBytes;
}
function safeRandom(len) {
    var randomBytes = new Uint8Array(len);
    while (len > 0) {
        var segmentSize = len % maxRandomQuota;
        segmentSize = segmentSize > 0 ? segmentSize : maxRandomQuota;
        var randomBytesSegment = new Uint8Array(segmentSize);
        webCrypto.getRandomValues(randomBytesSegment);
        len -= segmentSize;
        randomBytes.set(randomBytesSegment, len);
    }
    return randomBytes;
}
function safeRandom ( len ) { var randomBytes = new Uint8Array ( len ) ; while ( len > 0 ) { var segmentSize = len % maxRandomQuota ; segmentSize = segmentSize > 0 ? segmentSize : maxRandomQuota ; var randomBytesSegment = new Uint8Array ( segmentSize ) ; webCrypto . getRandomValues ( randomBytesSegment ) ; len -= segmentSize ; randomBytes . set ( randomBytesSegment , len ) ; } return randomBytes ; }
Gets random bytes from the CryptoEngine
@param {number} len - bytes count
@return {Uint8Array} - random bytes
Gets random bytes from the CryptoEngine