diff --git a/node/tenvoy.js b/node/tenvoy.js index adc817e5..b3fafa43 100644 --- a/node/tenvoy.js +++ b/node/tenvoy.js @@ -769,10 +769,11 @@ function tEnvoy(openpgpRef = openpgp, naclRef = nacl, sha256Ref = sha256) { } else { max = parseFloat(max); } - let random = await this.random.bytes(1).catch((err) => { + let bytes = await this.random.bytes(4).catch((err) => { reject(err); }); - resolve((random[0] / 255) * (max - min) + min); + let random = (new Uint32Array(bytes.buffer))[0] / 0x100000000; + resolve(random * (max - min) + min); }); } diff --git a/tenvoy.js b/tenvoy.js index 1d979134..95db6b81 100644 --- a/tenvoy.js +++ b/tenvoy.js @@ -46786,10 +46786,11 @@ function tEnvoy(openpgpRef = openpgp, naclRef = nacl, sha256Ref = sha256) { } else { max = parseFloat(max); } - let random = await this.random.bytes(1).catch((err) => { + let bytes = await this.random.bytes(4).catch((err) => { reject(err); }); - resolve((random[0] / 255) * (max - min) + min); + let random = (new Uint32Array(bytes.buffer))[0] / 0x100000000; + resolve(random * (max - min) + min); }); }