repositories
/
benchmarks-js.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
build(deps-dev): Bump @commitlint/config-conventional
[benchmarks-js.git]
/
benchmark-utils.mjs
diff --git
a/benchmark-utils.mjs
b/benchmark-utils.mjs
index ac10249991b7bf1cc6b9345e3fc8e22c4ef189f3..59521b614ebee8564dd93e258bac032bba210ddb 100644
(file)
--- 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
/**
* 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 () {
* @returns
*/
export function secureRandomWithRandomValues () {
- return crypto.getRandomValues(new Uint32Array(1))[0] / 0x100000000
+ return
web
crypto.getRandomValues(new Uint32Array(1))[0] / 0x100000000
}
/**
}
/**
@@
-93,5
+93,5
@@
export function generateRandomObject (
* @returns
*/
export async function sleep (ms) {
* @returns
*/
export async function sleep (ms) {
- return new Promise(resolve => setTimeout(resolve, ms))
+ return
await
new Promise(resolve => setTimeout(resolve, ms))
}
}