From d6c407132906074921b9274f3473b148c947dffc Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Tue, 21 Sep 2021 14:44:34 +0200 Subject: [PATCH] Reuse secureRandom MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- random.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/random.js b/random.js index 4b41596..98b59ed 100644 --- a/random.js +++ b/random.js @@ -1,18 +1,10 @@ const Benchmark = require('benchmark') -const crypto = require('crypto') -const { LIST_FORMATTER } = require('./benchmark-utils') +const { LIST_FORMATTER, secureRandom } = require('./benchmark-utils') const suite = new Benchmark.Suite() const maximum = 1000 -/** - * - */ -function secureRandom () { - return crypto.randomBytes(4).readUInt32LE() / 0x100000000 -} - /** * @param max * @param min -- 2.34.1