Generate random numbers within a custom range
This random number generator produces random numbers within a user-defined range using JavaScript's cryptographic-quality random number generator. You can control the number of values generated and whether duplicates are allowed. Statistics including sum, average, minimum, and maximum are displayed.
The generator uses the Math.random() function which produces a floating-point number between 0 (inclusive) and 1 (exclusive). This value is scaled and shifted to fit within the specified range. When duplicates are disabled, the generator ensures all output values are unique.
Math.random() uses a pseudorandom number generator (PRNG) which is suitable for most applications including games, simulations, and sampling. For cryptographic applications, use crypto.getRandomValues() instead. This calculator uses Math.random() which is fast and sufficient for general use.
If you request unique numbers from a range that is too small (e.g., 10 unique numbers between 1 and 5), the generator will return as many unique numbers as possible and then fill the remainder with duplicates.