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): apply updates
[benchmarks-js.git]
/
random.mjs
diff --git
a/random.mjs
b/random.mjs
index f814d3d37344900edacfe5d5190f106d64f92c19..16037df91dff6aaaa47880b1247be00525161878 100644
(file)
--- a/
random.mjs
+++ b/
random.mjs
@@
-1,9
+1,9
@@
-import
crypto from '
crypto'
+import
{ randomInt } from 'node:
crypto'
import Benchmark from 'benny'
import {
secureRandom,
secureRandomWithRandomValues
import Benchmark from 'benny'
import {
secureRandom,
secureRandomWithRandomValues
-} from './benchmark-utils.js'
+} from './benchmark-utils.
m
js'
const maximum = 281474976710654
const maximum = 281474976710654
@@
-76,9
+76,9
@@
Benchmark.suite(
max = Math.floor(max)
if (min != null && min !== 0) {
min = Math.ceil(min)
max = Math.floor(max)
if (min != null && min !== 0) {
min = Math.ceil(min)
- return Math.floor(
crypto.
randomInt(min, max + 1))
+ return Math.floor(randomInt(min, max + 1))
}
}
- return Math.floor(
crypto.
randomInt(max + 1))
+ return Math.floor(randomInt(max + 1))
}),
Benchmark.add('Math random integer generator', () => {
getRandomInteger(maximum)
}),
Benchmark.add('Math random integer generator', () => {
getRandomInteger(maximum)
@@
-100,6
+100,4
@@
Benchmark.suite(
format: 'table.html',
details: true
})
format: 'table.html',
details: true
})
-).catch(err => {
- console.error(err)
-})
+).catch(console.error)