const Benchmark = require('benchmark')
-const crypto = require('crypto')
-const { LIST_FORMATTER } = require('./benchmark-utils')
+const { LIST_FORMATTER, secureRandom } = require('./benchmark-utils')
const suite = new Benchmark.Suite()
const maximum = 1000
-/**
- *
- */
-function secureRandom () {
- return crypto.randomBytes(4).readUInt32LE() / 0x100000000
-}
-
/**
* @param max
* @param min
+ * @returns
*/
function getSecureRandomInteger (max, min = 0) {
max = Math.floor(max)
/**
* @param max
* @param min
+ * @returns
*/
function getRandomInteger (max, min = 0) {
max = Math.floor(max)
console.log(
'Fastest is ' + LIST_FORMATTER.format(this.filter('fastest').map('name'))
)
- // eslint-disable-next-line no-process-exit
+ // eslint-disable-next-line n/no-process-exit
process.exit()
})
.run()