Front end of the Slack clone application.

123456789101112131415161718
  1. module.exports = (function (global) {
  2. var uint32 = 'Uint32Array' in global
  3. var crypto = global.crypto || global.msCrypto
  4. var rando = crypto && typeof crypto.getRandomValues === 'function'
  5. var good = uint32 && crypto && rando
  6. if (!good) return Math.random
  7. var arr = new Uint32Array(1)
  8. var max = Math.pow(2, 32)
  9. function random () {
  10. crypto.getRandomValues(arr)
  11. return arr[0] / max
  12. }
  13. random.cryptographic = true
  14. return random
  15. })(typeof self !== 'undefined' ? self : window)