+const crypto = require('crypto')
const Benchmark = require('benny')
const {
secureRandom,
secureRandomWithRandomValues
} = require('./benchmark-utils')
-const crypto = require('crypto')
const maximum = 281474976710654
),
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))
}
format: 'table.html',
details: true
})
-)
+).catch(err => {
+ console.error(err)
+})