diff --git a/heliosbooth/js/jscrypto/random.js b/heliosbooth/js/jscrypto/random.js index e4c02b74e9ab7e07152f1118c408c95f9cda12af..dd69f9d4fcb14add53e641eef94072b377b93844 100644 --- a/heliosbooth/js/jscrypto/random.js +++ b/heliosbooth/js/jscrypto/random.js @@ -26,7 +26,7 @@ Random.getRandomInteger = function(max) { var bit_length = max.bitLength(); Random.setupGenerator(); var random; - random = sjcl.random.randomWords(bit_length / 32, 0); + random = sjcl.random.randomWords(Math.ceil(bit_length / 32)+2, 0); // we get a bit array instead of a BigInteger in this case var rand_bi = new BigInt(sjcl.codec.hex.fromBits(random), 16); return rand_bi.mod(max);