From a551f3165f8e39ad826de48c772d1203a5c9c9de Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Fri, 25 Aug 2023 21:57:12 +0200 Subject: [PATCH] refactor: node 16 compatibility MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- benchmark-utils.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/benchmark-utils.mjs b/benchmark-utils.mjs index 2f1a862..d3757b5 100644 --- a/benchmark-utils.mjs +++ b/benchmark-utils.mjs @@ -1,4 +1,4 @@ -import crypto from 'crypto' +import crypto, { webcrypto } from 'crypto' /** * Generate a cryptographically secure random number in the [0,1[ range @@ -13,7 +13,7 @@ export function secureRandom () { * @returns */ export function secureRandomWithRandomValues () { - return crypto.getRandomValues(new Uint32Array(1))[0] / 0x100000000 + return webcrypto.getRandomValues(new Uint32Array(1))[0] / 0x100000000 } /** -- 2.34.1