← Back to tools
Utility

Random Number

Generate random numbers within any range.

How the Random Number Generator Works

This generator produces random integers within a user-defined minimum and maximum range. It can generate single numbers or a list of multiple numbers, with options to allow or disallow duplicates in the output.

Formula Used

Random Integer = Math.floor(Math.random() × (Max − Min + 1)) + Min
Math.random()
— a built-in JavaScript function that returns a pseudo-random decimal between 0 (inclusive) and 1 (exclusive)
Min
— the lower limit of the desired range (inclusive)
Max
— the upper limit of the desired range (inclusive)

Example Calculation

If you set Min = 1 and Max = 100, the formula scales the random decimal: Math.floor(random * 100) + 1. This returns a random integer such as 42.

Frequently Asked Questions