PK Systems PK Systems
Generators

Random Number Generator

Pick numbers in any range — with or without duplicates, sorted or shuffled, copy-paste ready.

Random Number Generator

Result

What this tool does

Generates random integers in any range you pick, in any quantity from 1 to 10,000. Toggle whether duplicates are allowed (off for lottery-style unique draws, on for simulating dice or coin sequences), choose to sort the output ascending or leave it shuffled, and pick the format you want — one number per line, comma-separated for spreadsheets, space-separated for quick CLI paste, or as a JavaScript array literal for code. Randomness is properly uniform: we use crypto.getRandomValues() with rejection sampling to remove the modulo bias that Math.random() % range introduces. For unique draws over dense ranges, we run a partial Fisher-Yates shuffle; for sparse ranges, a hash-set with retries. The whole thing runs locally — no upload, no logging, no rate limits.

How to use it

Set a min and a max — they can be negative, zero or anything in between. Set how many numbers you need. Decide whether to allow duplicates (turn off for raffles, on for repeated rolls). Decide whether to sort the output ascending. Pick a format: lines, comma, space or array. Hit Generate. The result appears in the panel; if you asked for one number, it shows huge; for many, it shows in a scrollable code block. Hit Copy to push the whole thing to your clipboard. Re-running with the same settings produces a fresh draw every time — there is no seed.

How the randomness works

Each draw samples a 32-bit integer from crypto.getRandomValues() and rejects any draw above floor(2^32 / range) * range. The accepted draw modulo range plus min is your number — provably uniform across the whole range. For unique draws, we use one of two strategies: when the range is dense enough (≤ 200,000 values), we materialise the full pool and partial-Fisher-Yates shuffle the first count entries — that's O(count), not O(range). When the range is sparse and big, we use a hash-set with retries — bounded by the 10,000-count limit so retries never explode. Sorting (when enabled) is a final ascending pass.

Common settings

A few example combinations to get you going.

Use Settings
Lottery numbers (5/49)Min 1, max 49, count 5, duplicates off, sort on
Coin sequence (10 flips)Min 0, max 1, count 10, duplicates on
Random colour byteMin 0, max 255, count 1
Pick 3 winners from 100Min 1, max 100, count 3, duplicates off

Frequently asked questions

Is it really random?
Yes — verifiably uniform. We use crypto.getRandomValues() with rejection sampling, which is the standard CSPRNG approach for unbiased integer ranges.
Why ask more uniques than the range allows?
The tool catches that and shows an error — there's no way to draw 10 unique numbers from a range of 5. Either turn duplicates on or widen the range.
Can I seed the RNG?
No. CSPRNGs by design cannot be seeded for reproducibility — that would defeat the security guarantee. If you need reproducible "random" output for tests, use a seeded PRNG library in code.
What's the maximum count?
10,000 per run. Beyond that, the output gets unwieldy in the browser; for bigger draws, run the tool a few times or generate them server-side.
Does it work with negative numbers?
Yes. Min and max can be any integers, positive or negative. The range is max − min + 1, so make sure max ≥ min.
Is anything sent over the network?
No. Generation runs in your browser. The output stays local until you copy it.