repositories
/
benchmarks-js.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
build: update volta pnpm version
[benchmarks-js.git]
/
random.js
diff --git
a/random.js
b/random.js
index 272d8e6969c23f71c234cad66ca93d8ffbe889dd..8c0fa86e669b384e4d812478e00b6a61716031c8 100644
(file)
--- a/
random.js
+++ b/
random.js
@@
-1,9
+1,9
@@
+const crypto = require('crypto')
const Benchmark = require('benny')
const {
secureRandom,
secureRandomWithRandomValues
} = require('./benchmark-utils')
const Benchmark = require('benny')
const {
secureRandom,
secureRandomWithRandomValues
} = require('./benchmark-utils')
-const crypto = require('crypto')
const maximum = 281474976710654
const maximum = 281474976710654
@@
-74,7
+74,7
@@
Benchmark.suite(
),
Benchmark.add('Crypto random integer generator', (max = maximum, min = 0) => {
max = Math.floor(max)
),
Benchmark.add('Crypto random integer generator', (max = maximum, min = 0) => {
max = Math.floor(max)
- if (min !=
= undefined
&& min !== 0) {
+ if (min !=
null
&& min !== 0) {
min = Math.ceil(min)
return Math.floor(crypto.randomInt(min, max + 1))
}
min = Math.ceil(min)
return Math.floor(crypto.randomInt(min, max + 1))
}
@@
-100,4
+100,6
@@
Benchmark.suite(
format: 'table.html',
details: true
})
format: 'table.html',
details: true
})
-)
+).catch(err => {
+ console.error(err)
+})