From: Jérôme Benoit Date: Tue, 21 Sep 2021 12:44:34 +0000 (+0200) Subject: Reuse secureRandom X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=d6c407132906074921b9274f3473b148c947dffc;p=benchmarks-js.git Reuse secureRandom Signed-off-by: Jérôme Benoit --- 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