Skip to main content
Generator Hut

Random Number Generator

Any range, one number or ten thousand — with presets for dice-style picks, percentages and fixed-width PIN codes.

Generator settings

Between 1 and 10,000.

Common ranges

Code presets keep leading zeros, so a draw of 42 arrives as 0042.

Results can be any whole number from the lowest to the highest — both ends included. Negative numbers are allowed.

No number repeats within a batch.

Generated numbers

Your numbers will appear here. Press Generate to start.

Pick any minimum and maximum and generate random numbers between them — or use a preset to jump straight to the common cases: 1 to 10 for a quick pick, 1 to 100 for percentages and games, or a fixed-width range for PINs and verification codes. The code presets keep leading zeros, so a draw of 42 arrives as 0042 and stays four characters wide wherever you paste it. Negative numbers, very large ranges and batches up to 10,000 are all supported, and every value comes from your device's cryptographic random source.

Why use this tool?

Any range you like

The lowest and highest numbers are yours to set, including negative values and ranges up to a quadrillion wide — and the presets fill the ranges people reach for most with one click.

Codes keep their zeros

The digit presets pad every result to a fixed width, so 7 becomes 0007. A code and a number are not the same thing: 42 and 0042 are the same integer, but only one is a valid four digit PIN.

100% private

Generation happens in your browser using the Web Crypto API. Nothing is sent to a server, nothing is logged, and there is no analytics script watching what you produce.

Built for batches

Draw a single winner or 10,000 sample values, block duplicates when each value may appear once, sort the results, and export the lot as CSV or JSON.

How this random number generator works

Numbers come from the Web Crypto API, which draws on the operating system's cryptographically secure entropy pool. Unlike Math.random(), its output cannot be reproduced by someone who has seen earlier results — which is what makes it safe to use for a public draw.

Mapping raw entropy onto an arbitrary range is where most generators quietly go wrong. Taking a random 32-bit value modulo your range makes the lowest numbers slightly more likely whenever the range is not a power of two. This tool discards draws that land in that uneven remainder and redraws, so the distribution is genuinely uniform across whatever bounds you set.

For ranges wider than 2^32 the generator composes a 53-bit value from two draws, keeping results exact integers rather than drifting into floating-point imprecision.

Padding is formatting, not randomness: the 4-digit PIN preset draws uniformly from 0 to 9,999 and then renders the result four characters wide. The distribution is identical to the unpadded draw — only the presentation changes, which is why the same engine serves both plain numbers and fixed-width codes.

How to use it

  1. Step 1: Set your range

    Enter the lowest and highest numbers you want included — both ends count — or click a preset: 1–10, 1–100, or a fixed-width code size. Editing either bound clears a preset's zero-padding.

  2. Step 2: Choose how many and how

    Set the quantity, decide whether values may repeat, and pick a sort order.

  3. Step 3: Generate

    Press Generate, then copy a single value, copy them all, or export the batch.

Example usage

Picking a giveaway winner
Range 1 to 4,812 with a quantity of one — the entrant at that row number wins, and the draw is reproducible in front of an audience.
Issuing door codes
The 4-digit PIN preset with unique mode on and a quantity of 60 — one code per locker, no collisions, leading zeros intact in the CSV export.
Sampling a spreadsheet
Fifty unique numbers between 2 and 1,001, sorted ascending, used as the row numbers to audit.
Assigning turn order
A unique number per participant with duplicates blocked, so nobody shares a slot.

Frequently asked questions

Can I generate negative numbers?

Yes. Set a negative minimum — for example -50 to 50 — and the full range is drawn from uniformly. Zero-padding is not applied to negative values.

Are both the minimum and maximum included?

Yes, both ends are inclusive. A range of 1 to 100 can return 1 and can return 100, and each has the same chance as any other value.

How do I make 4-digit PINs or 6-digit codes?

Use the code presets. Each one fixes the range and pads results to a constant width, so every draw is a valid code rather than a bare number. On strength: each digit multiplies the guessing space by ten — four digits gives 10,000 possibilities and is the practical floor for a PIN, and only when paired with an attempt limit. Six digits is the standard for one-time passcodes, which also lean on expiry for their security.

What happened to the separate 1–10, 1–100 and digit generator pages?

They were merged into this page. Every range they covered is one preset click away, the padding behavior is identical, and the old addresses redirect here — so a bookmark to any of them still works.

What is the difference between unique and non-unique?

Unique mode is sampling without replacement: once a number is drawn it cannot appear again in that batch, so you can never ask for more values than the range holds. With unique off, every draw is independent and repeats are expected — roughly as often as probability says they should be.

Is this suitable for a prize draw or lottery?

The randomness is cryptographically secure and unbiased, which is the technical bar. Whether it satisfies a regulator is a separate question — formal lotteries usually require an audited, certified system with a verifiable record of each draw.

Browse every tool in Random Number Generators & Number Tools.