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
This tool uses JavaScript's Math.random() function, which is a pseudo-random number generator (PRNG). It is highly random and suitable for games, statistics, and decisions, but not for cryptographic purposes.
Yes. You can enter negative values in the Min and Max fields. For example, setting Min = -10 and Max = 10 will generate numbers between -10 and 10.
If checked, the generator can output the same number multiple times when generating a list. If unchecked, all generated numbers in the list will be unique.
Yes. The generated number can be equal to both the minimum and maximum values you enter.
Simply set the Min value to 1 and the Max value to 6. Click generate to get a random roll.