Generators

Random Number Generator

Generate random integers with custom min/max range, quantity, and unique option.

Loading interactive tool…

Embed this tool on your site

About this tool

A bounded random integer generator with minimum, maximum, quantity, unique-mode, and negative-range support so you get the exact list you need without off-by-one bugs or writing a five-line snippet each time. Both boundaries are inclusive, unique mode prevents duplicates for raffle and lottery draws, and up to 1,000 numbers are produced per click as a comma-separated list that copies with one button. Numbers come from the browser's crypto.getRandomValues with rejection sampling, so every value in the range is equally likely, even across huge ranges up to ±9,007,199,254,740,991. Negative ranges work for signed-integer test cases and math drills, and a validation message appears instead of output if you request more unique numbers than your range contains.

Why use it

  • Inclusive Minimum and Maximum: Both bounds are included in the possible output — if you set 1 to 100, the result can be exactly 1 or exactly 100. Many programming snippets use exclusive upper bounds by default; this tool matches the natural reading of a range.

  • Unique Mode: Tick 'Unique numbers only' to ensure every number in the output appears exactly once. This is essential for lottery-style draws and raffle ticket picks where a duplicate winner would require an awkward re-draw.

  • Negative Ranges: Enter a negative minimum to generate numbers spanning zero, such as -50 to 50 for signed-integer boundary testing or temperature-range math drills.

  • Up to 1,000 per Batch: Request a single number or up to a thousand in one click, enough to seed a test fixture or classroom sample without writing a script.

  • Cryptographic Randomness: Numbers come from crypto.getRandomValues with rejection sampling, so there is no modulo bias toward lower values.

  • Range Validation: When unique mode is on and the requested quantity exceeds the number of integers in the range, the tool tells you the maximum possible instead of producing a truncated list.

How to use

  1. Set the lowest value of your range in the Minimum field — this bound is inclusive.
  2. Set the highest value in the Maximum field — this bound is also inclusive, so 1 to 6 includes 6.
  3. Enter how many numbers you want in the Quantity field, from 1 to 1,000.
  4. Tick 'Unique numbers only' if duplicates should not appear in the output, such as for lottery or raffle draws.
  5. Click Generate (or press Enter in any field) and review the comma-separated numbers in the output area.
  6. Click Copy output to copy the list, then paste it into your spreadsheet, fixture, or script.

When it helps

  • When running a classroom probability demonstration and you need a batch of bounded random integers students can analyze for distribution patterns.
  • When seeding a database fixture file with realistic-looking integer IDs or scores that fall within a known valid range.
  • When picking raffle ticket winners from a numbered range without wanting to set up a spreadsheet formula or write a quick script.
  • When generating test input data for a function that validates integer bounds and you need values at, inside, and near the boundaries.
  • When teaching students about negative numbers and you need signed-integer examples drawn from a spanning range like -10 to 10.
  • When a developer needs a quick set of unique random integers for a hash-table collision test or sampling-without-replacement scenario.

Examples

Lottery-style 6 of 49

Input

min: 1, max: 49, count: 6, unique: yes

Expected result

7, 14, 23, 31, 42, 48

Test fixture seeds

Input

min: 1000, max: 9999, count: 5, unique: no

Expected result

4827, 1153, 9046, 2371, 6804

Negative range temperature

Input

min: -20, max: 35, count: 3, unique: no

Expected result

-7, 12, -15

Tips

  • Always tick 'Unique numbers only' for raffle or lottery draws — a duplicate result would require an awkward public re-draw and undermine trust in the fairness of the process.
  • Set your range before deciding the quantity — with unique mode on, the quantity must fit inside the range or the tool will show the maximum it can produce.
  • Paste the copied comma-separated list into a spreadsheet cell and split it with Text to Columns, saving the step of manually separating values.
  • Need more than 1,000 numbers? Run several batches and paste them one after another.
  • When teaching probability in a classroom, generate multiple batches and compare their distributions to demonstrate convergence toward uniform spread as sample size grows.

Frequently Asked Questions

Are min and max inclusive or exclusive?
Both are inclusive. If you set Minimum to 1 and Maximum to 6, the output can be 1, 2, 3, 4, 5, or 6 — including both endpoints. This matches the natural human reading of 'a number between 1 and 6' without any off-by-one adjustment needed.
What happens if I ask for more unique numbers than the range allows?
The tool checks this before generating and shows a message such as 'Unique mode can generate at most 49 values in this range.' Reduce the quantity, widen the range, or turn off unique mode to continue.
Can I generate decimal or floating-point numbers?
The tool generates integers only, and the Minimum, Maximum and Quantity fields must be whole numbers. For floating-point random numbers, use a browser console snippet like Math.random() * (max - min) + min.
Is the randomness suitable for cryptographic use?
The generator uses crypto.getRandomValues, the browser's cryptographically secure source, with rejection sampling to keep every value equally likely. That is strong enough for draws and test data; for generating keys or nonces, use a dedicated cryptographic library.
How do I get the numbers into a spreadsheet?
Click Copy output. The numbers are copied as one comma-separated line (for example 7, 14, 23), which you can paste into a cell and split with Data > Split text to columns in Google Sheets or Text to Columns in Excel. There is no newline output option.
Why are the same numbers showing up — is it broken?
If unique mode is off, duplicates are expected — each number is drawn independently so any value can appear more than once. This is statistically normal and not a bug. Tick 'Unique numbers only' if you need a draw without replacement.
What is the maximum count I can request at once?
Quantity is capped at 1,000 numbers per generation; larger values are reset to 1,000. For bigger data sets, generate several batches or use a short Node.js or Python script.
Can I seed the generator for reproducible results?
No. The tool uses the browser's entropy source, which cannot be manually seeded. For reproducible random sequences in tests, use a seeded PRNG library like seedrandom in Node.js, which lets you specify a seed string and replay the same sequence.
How large can the range be?
Minimum and maximum can be any whole numbers between -9,007,199,254,740,991 and 9,007,199,254,740,991, the largest integers JavaScript represents exactly. Draws use 64-bit random values, so even a range like 1 to 100 trillion returns instantly, in unique mode too.

Explore the category

Glossary

Inclusive Range
A range where both the minimum and maximum boundary values are valid possible outputs. An inclusive range of 1 to 6 can produce 1, 2, 3, 4, 5, or 6 — all six values included.
Sampling Without Replacement
A draw method where each selected value is removed from the pool before the next draw, preventing duplicates. Lottery and raffle draws use sampling without replacement to ensure each ticket can win at most once.
Uniform Distribution
A probability distribution where every value in the range has exactly equal likelihood of being selected. A fair random number generator produces a uniform distribution over its range.
Seed
An initial value fed into a pseudo-random number generator to determine its output sequence. Using the same seed always produces the same sequence, which is useful for reproducible testing but incompatible with fairness-critical draws.
Integer Overflow
An error condition where an integer calculation exceeds the maximum value representable by the data type. JavaScript uses 64-bit floats for numbers, so integers remain exact up to 2^53, well beyond any practical range for this tool.
PRNG
Pseudo-Random Number Generator — an algorithm that produces sequences appearing statistically random but derived deterministically from a seed. Most language built-ins are PRNGs; cryptographically secure variants (CSPRNGs) add entropy from hardware sources.
A LITTLE HELP. A LOT DONE.
Good tools.
Great flow.

Your shortcut to the everyday. Create, convert, calculate,
and get back to what you love.

✓ Free to use✓ No sign-up✓ 500+ possibilities