refactor: code cleanup
[benchmarks-js.git] / benchmark-utils.mjs
index ac10249991b7bf1cc6b9345e3fc8e22c4ef189f3..35515c5197f3c333db7286726a8907f2a97d28e7 100644 (file)
@@ -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
 }
 
 /**