X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=benchmark-utils.mjs;h=35515c5197f3c333db7286726a8907f2a97d28e7;hb=adcb60cc45cbcbd82965be9a52030ace872ded3a;hp=ac10249991b7bf1cc6b9345e3fc8e22c4ef189f3;hpb=be798e12d5107d4b0f09a82be9de4e5f5abfd694;p=benchmarks-js.git diff --git a/benchmark-utils.mjs b/benchmark-utils.mjs index ac10249..35515c5 100644 --- a/benchmark-utils.mjs +++ b/benchmark-utils.mjs @@ -1,4 +1,4 @@ -import crypto from 'crypto' +import crypto, { webcrypto } from 'node:crypto' /** * Generate a cryptographically secure random number in the [0,1[ range @@ -9,11 +9,11 @@ export function secureRandom () { } /** - * Generate a cryptographically secure random number in the [0,1[ range + * Generate a cryptographically secure random number in the [0,1[ range * @returns */ export function secureRandomWithRandomValues () { - return crypto.getRandomValues(new Uint32Array(1))[0] / 0x100000000 + return webcrypto.getRandomValues(new Uint32Array(1))[0] / 0x100000000 } /**