- Benchmark.add('Crypto random integer generator', () => {
- crypto.randomInt(maximum)
+ Benchmark.add('Crypto random integer generator', (max = maximum, min = 0) => {
+ max = Math.floor(max)
+ if (min != null && min !== 0) {
+ min = Math.ceil(min)
+ return Math.floor(crypto.randomInt(min, max + 1))
+ }
+ return Math.floor(crypto.randomInt(max + 1))