Skip to content

Commit 2ca9712

Browse files
committed
fixup! crypto: add buffering to randomInt
1 parent 3988798 commit 2ca9712

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lib/internal/crypto/random.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ const {
1717
const { validateNumber } = require('internal/validators');
1818
const { isArrayBufferView } = require('internal/util/types');
1919
const { FastBuffer } = require('internal/buffer');
20-
const { setImmediate } = require('timers');
2120

2221
const kMaxUint32 = 2 ** 32 - 1;
2322
const kMaxPossibleLength = MathMin(kMaxLength, kMaxUint32);
@@ -187,7 +186,7 @@ function randomInt(min, max, callback) {
187186
if (x <= randLimit) {
188187
const n = (x % range) + min;
189188
if (isSync) return n;
190-
setImmediate(() => callback(undefined, n));
189+
process.nextTick(callback, undefined, n);
191190
return;
192191
}
193192
}

0 commit comments

Comments
 (0)