Random Number Generator
Generate random numbers in a range, with optional uniqueness, using secure randomness.
Runs in your browser — files never leave your device
How it works
This tool generates whole numbers in a range you choose, with both ends included — one number or many at once, and optionally all different. The randomness comes from crypto.getRandomValues, the browser’s cryptographically secure random number generator, which is seeded with entropy from your operating system. That’s a stronger source than the basic Math.random function many simple generators use, whose output can be predictable.
For each number, the tool draws one random 32-bit unsigned integer — a value from 0 to 4,294,967,295 — and maps it into your range with modular arithmetic: result = min + (draw mod range size), where range size = max − min + 1. In Unique mode it keeps drawing and adds results to a set until the set holds the requested count — sampling without replacement, like pulling raffle tickets from a hat — and it refuses if you ask for more unique numbers than the range contains. Decimal inputs are floored to whole numbers before generating.
Worked example with the default 1–100 range: range size = 100 − 1 + 1 = 100. Suppose the 32-bit draw is 3,405,691,582; then 3,405,691,582 mod 100 = 82, and the result is 1 + 82 = 83. One subtlety of this mapping: 2^32 = 4,294,967,296 is not an exact multiple of 100, so outcomes 1 through 96 can each be produced by 42,949,673 different draws while 97 through 100 each have 42,949,672 — a bias of about one part in 43 million, far too small to ever notice, but not exactly zero.
That makes this generator well suited to picks, games, sampling, classroom draws, and informal giveaways. Repeats in normal mode are expected and correct, because every draw is independent. What it is not: a certified gambling system. Regulated lotteries and prize draws involving real money require audited, certified generators with verifiable logs, and cryptographic keys should come from purpose-built tooling rather than a web page — despite the secure source, use this for everyday randomness, not for money or security decisions.
Frequently asked questions
- Is it truly random?
- It uses the browser’s cryptographically secure generator (crypto.getRandomValues), which draws on entropy collected by your operating system, so the output is unpredictable for any practical purpose. That’s a meaningful step up from Math.random-style pseudo-random generators, whose sequences can be reproduced if their internal state is known. No software source is “true” physical randomness, but for picks, draws, and sampling this is as good as a browser gets.
- What does the Unique option do?
- It switches to sampling without replacement, like pulling raffle tickets from a hat: the tool keeps drawing until it has the requested number of distinct values, so nothing repeats. The count can’t exceed the range size — asking for 20 unique numbers between 1 and 10 shows an error, because only 10 distinct values exist.
- Are the min and max included in the results?
- Yes — the range is inclusive on both ends, so 1 to 100 can produce both 1 and 100, giving 100 possible values in total (max − min + 1). Decimal inputs are floored to whole numbers first: entering 5.9 as the minimum uses 5.
- Why do I see the same number more than once?
- In normal mode every draw is independent, with replacement, so repeats are statistically expected — especially when you generate many numbers from a small range. A repeat is a sign of genuine randomness, not a bug. Tick Unique if each value should appear at most once.
- Can I use it for a lottery or contest with real money?
- For informal, low-stakes draws — picking a giveaway winner, assigning teams, classroom games — yes. Regulated lotteries, raffles, and gambling legally require certified random number generators with audit trails, which a general-purpose web tool doesn’t provide. The range mapping also carries a mathematically tiny modulo bias, another reason not to use it where money rides on perfect uniformity.
- Are the numbers generated on a server?
- No. Everything happens locally in your browser using the Web Crypto API, and the numbers are never transmitted or stored. Refreshing the page clears the results.
Related tools
- Percentage CalculatorWork out percentages: X% of Y, what percent one number is of another, and percentage change.
- Color Converter (HEX / RGB / HSL)Convert colors between HEX, RGB and HSL and preview the result.
- Color Contrast CheckerCheck the contrast ratio between two colors against WCAG AA and AAA standards.
- QR Code GeneratorCreate QR codes for URLs, text, Wi-Fi and contacts in your browser and download as PNG.
- Barcode GeneratorGenerate Code128, EAN and UPC barcodes locally and download as an image.
- Password GeneratorGenerate strong, random passwords with custom length and character sets — in your browser.