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 eslint from 8.54.0 to 8.55.0
[benchmarks-js.git]
/
benchmark-utils.mjs
diff --git
a/benchmark-utils.mjs
b/benchmark-utils.mjs
index 35515c5197f3c333db7286726a8907f2a97d28e7..7c7832e897d76061383214a3763142fa68159c6a 100644
(file)
--- 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 () {
/**
* 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 () {
* @returns
*/
export function secureRandomWithRandomValues () {
- return
webcrypto.
getRandomValues(new Uint32Array(1))[0] / 0x100000000
+ return 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))
}
}