hexo/node_modules/math-random/node.js

14 lines
235 B
JavaScript
Raw Normal View History

2023-10-03 11:14:36 +08:00
var crypto = require('crypto')
var max = Math.pow(2, 32)
module.exports = random
module.exports.cryptographic = true
function random () {
var buf = crypto
.randomBytes(4)
.readUInt32BE(0)
return buf / max
}