diff --git a/lib/getRandomValue.js b/lib/getRandomValue.js index 5d8797d..e2c24d2 100644 --- a/lib/getRandomValue.js +++ b/lib/getRandomValue.js @@ -1,9 +1,8 @@ var crypto = require('crypto'); -var lim = Math.pow(2, 32) - 1; +var lim = Math.pow(2, 32); module.exports = function random () { - return Math.abs(crypto.randomBytes(4) - .readInt32BE() / lim); + return crypto.randomBytes(4).readUInt32BE() / lim; };