node.js 222 B

12345678910111213
  1. var crypto = require('crypto')
  2. var max = Math.pow(2, 32)
  3. module.exports = random
  4. module.exports.cryptographic = true
  5. function random () {
  6. var buf = crypto
  7. .randomBytes(4)
  8. .readUInt32BE(0)
  9. return buf / max
  10. }