From b77517bab6445c121ec357749683416b4c656438 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Wed, 29 Nov 2023 21:12:09 +0100 Subject: [PATCH] refactor: cleanup import MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- benchmark-utils.mjs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/benchmark-utils.mjs b/benchmark-utils.mjs index 59521b6..7c7832e 100644 --- a/benchmark-utils.mjs +++ b/benchmark-utils.mjs @@ -1,11 +1,11 @@ -import crypto, { webcrypto } from 'node:crypto' +import { randomBytes, getRandomValues } from 'node:crypto' /** * Generate a cryptographically secure random number in the [0,1[ range * @returns */ export function secureRandom () { - return crypto.randomBytes(4).readUInt32LE() / 0x100000000 + return randomBytes(4).readUInt32LE() / 0x100000000 } /** @@ -13,7 +13,7 @@ export function secureRandom () { * @returns */ export function secureRandomWithRandomValues () { - return webcrypto.getRandomValues(new Uint32Array(1))[0] / 0x100000000 + return getRandomValues(new Uint32Array(1))[0] / 0x100000000 } /** -- 2.34.1