Skip to main content

util.randomInt()

Synchronously generates a random integer in the inclusive min..max range. Bounds and max + 1 must be safe integers; range size must be smaller than 2^48. Invalid types/options throw TypeError; size/range throws RangeError.

Signature

Example

See all util methods or runtime basics.
Last modified on November 8, 2026