Sha256: 219bc037d9060207ff6f6db905d05cdae004ae6281d4506396e000b67be37540

Contents?: true

Size: 503 Bytes

Versions: 12

Compression:

Stored size: 503 Bytes

Contents

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)

Version data entries

12 entries across 12 versions & 4 rubygems

Version Path
jass-0.9.5 vendor/node_modules/math-random/browser.js
jass-0.9.4 vendor/node_modules/math-random/browser.js
optimacms-0.4.3 spec/dummy/node_modules/math-random/browser.js
optimacms-0.4.2 spec/dummy/node_modules/math-random/browser.js
locomotivecms-4.0.0.alpha1 app/javascript/node_modules/math-random/browser.js
lux_assets-0.2.11 ./node_modules/math-random/browser.js
lux_assets-0.2.9 ./node_modules/math-random/browser.js
lux_assets-0.2.4 ./node_modules/math-random/browser.js
lux_assets-0.2.2 ./node_modules/math-random/browser.js
lux_assets-0.2.1 ./node_modules/math-random/browser.js
locomotivecms-3.4.0 app/javascript/node_modules/math-random/browser.js
jass-0.9.3 vendor/node_modules/math-random/browser.js