🎲 Random Number Generator
Generates secure random numbers using crypto.getRandomValues(), with customizable range, count, deduplication, sorting, and statistics.
What makes this one different from Math.random
Most random number snippets on the web are one line long and call Math.random, which is a fast pseudo-random generator seeded from the clock. It is designed for animation and effects, not for unpredictability, and its sequence can in principle be reconstructed by anyone who can work out where it started. This generator uses the browser's cryptographic source, the same primitive that produces encryption keys and session tokens, and takes it from the operating system's entropy pool.
It also corrects a subtler problem. Turning a random value into a number in a range is normally done with a remainder operation, and unless the range divides the generator's output evenly that quietly favours the low end — the same effect that skews the D100 on this site's dice roller. This one rejects the uneven tail of the range and draws again, which costs nothing measurable and leaves every value equally likely. If you need to defend a result, that is the difference that matters.
Setting a range and quantity
Enter a minimum and a maximum and the generator returns whole numbers between them, inclusive at both ends. The minimum has to be strictly less than the maximum, so you cannot use this to repeat a fixed value; leave a field blank and the defaults are nought and one hundred.
Quantity takes anything from one to one hundred and is clamped to that range. Duplicates are allowed by default. Switch to the no-duplicates mode and you get a draw without replacement — useful for picking lottery numbers, assigning distinct items, or shuffling a short list. In that mode the quantity cannot exceed the number of values in the range, and the tool says so rather than looping forever trying to find values that are not there.
Sorting, statistics and history
Results come back in the order they were drawn, and the sort control reorders them ascending or descending without changing which numbers you got. Below the results you get the count, the smallest and largest values actually drawn, the average and the sum — note that these describe the draw, not the range you asked for, so a minimum of 3 in the statistics means the smallest number you got was 3, not that you excluded 0, 1 and 2.
A draw can be copied to the clipboard or saved to a history list, which is kept in your browser so it survives a reload and can be restored or cleared. The history is a record of what you generated, not a log of anything sent anywhere — nothing leaves the page.
FAQ
Is this random enough for a lottery or a draw?
The numbers come from the browser's cryptographic generator with the bias-corrected range reduction, which is a stronger guarantee than an ordinary pseudo-random generator can give. Whether it satisfies a given regulator or rulebook is a separate question — check the requirement before relying on any browser-based tool for something official.
Why can I not set the minimum equal to the maximum?
The generator requires a minimum below the maximum, so a range of a single value is rejected with a message rather than silently accepted. If you want a repeated fixed value, that is not a random number.
What happens if I leave the fields empty?
They fall back to sensible defaults: nought for the minimum, one hundred for the maximum and one for the quantity. A field containing something that is not a number is treated the same way.
What is the largest quantity I can ask for?
One hundred. A larger value is clamped down. In no-duplicates mode the ceiling is lower still: it cannot exceed the number of whole numbers in your range.
Are the numbers in the statistics the smallest and largest possible?
No, they are the smallest and largest you actually drew. A "Min" of 3 out of a range of 1 to 100 means the lowest number in this draw was 3, which is exactly the kind of thing you want to be able to see.
Is the history saved between visits?
Yes, it is stored in your browser and survives a reload until you clear it. It is local to that browser and that device, and it is never uploaded — clearing your site data removes it.