math-random
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -5,3 +5,3 @@ module.exports = (function (global) { | ||
var rando = crypto && typeof crypto.getRandomValues === 'function' | ||
var good = uint32 && crypto && rando | ||
var good = uint32 && rando | ||
if (!good) return Math.random | ||
@@ -8,0 +8,0 @@ |
@@ -10,5 +10,5 @@ var crypto = require('crypto') | ||
.randomBytes(4) | ||
.toString('hex') | ||
.readUInt32BE(0) | ||
return parseInt(buf, 16) / max | ||
return buf / max | ||
} |
{ | ||
"name": "math-random", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "a drop-in replacement for Math.random that uses cryptographically secure random number generation, where available", | ||
@@ -5,0 +5,0 @@ "main": "node.js", |
2839
6