Random Number Generator
Generate random integers in a range (with or without duplicates), shuffle a number sequence, or roll dice. Powered by the browser Web Crypto API.
Drawing a winner, picking a student, deciding who goes first, rolling dice — these need randomness that is fair and explainable. This tool draws on the browser's Web Crypto source, which is more uniform and less predictable than Math.random. Three modes cover the usual cases: integers from a closed range with repeats optionally disabled, shuffling a whole sequence, and rolling multi-sided dice.
Decide the rules before drawing. A prize draw wants repeats switched off, which is equivalent to drawing without replacement, and the count cannot exceed the number of integers in the range. And random does not mean evenly spread in the short run — two identical results in a row is perfectly normal, not grounds for suspicion. A draw that has to be auditable should have its rules and algorithm published in advance rather than explained afterwards.
Did this tool solve your problem?
Submitting sends the tool name, your input and the current result to the server. Please do not include ID numbers, phone numbers or other private data.
AI assistant It answers using your current input and result
Asking again sends your current input and result to the server once more. Please do not include private data.
How to use
- Choose the mode: range draw, shuffle, or dice.
- Enter the range and how many values to draw or roll.
- Decide whether repeats are allowed.
- Record the result; for an auditable draw, publish the rules beforehand.
How it works
Random integers
Random integers: set the minimum, maximum and count; the range is inclusive [min, max]. Checking "no repeats" makes it draw without replacement.
Random shuffle
Random shuffle: scrambles the consecutive integers from min to max (say 1–50) into a random order — ideal for roll call and draw ordering.
Dice rolling
Dice: supports 2/6/20-sided dice with a roll count; each roll is independent.
Code example
JavaScript A cryptographically secure random integer in a range
// Inclusive [min, max]; rejection sampling keeps it uniform
function randInt(min, max) {
const range = max - min + 1;
const limit = Math.floor(0x100000000 / range) * range;
const buf = new Uint32Array(1);
do { crypto.getRandomValues(buf); } while (buf[0] >= limit);
return min + (buf[0] % range);
}
randInt(1, 100);
Python Sampling without replacement
import secrets, random
rng = secrets.SystemRandom() # cryptographically secure source
rng.sample(range(1, 51), 5) # 5 distinct values from 1-50
rng.randint(1, 6) # roll a die
# Note: the plain random module is pseudo-random — use SystemRandom where fairness matters (draws, lotteries)
FAQ
Is this true randomness?
It's based on the browser's Web Crypto API — a cryptographically secure source, more uniform and less predictable than Math.random(), fully fair for raffles and draws.
What's the maximum per run?
Up to 1,000 random integers per run; random shuffle supports up to 10,000 consecutive numbers.
Are the results uploaded?
No. Every number is generated locally in your browser, and the history stays on your machine — nothing reaches a server.
Which mode is fairest for a raffle?
Use the no-repeat draw so a number can't win twice, with the cryptographic source rather than Math.random. For a fully auditable draw, fix the seed and publish the algorithm so anyone can verify the result.
Random vs. pseudo-random — what's the difference?
True randomness comes from physical noise and is unpredictable; pseudo-randomness comes from algorithms and seeds — knowing the seed reproduces everything. Cryptographically secure PRNGs are unpredictable and fit raffles and key generation; ordinary Math.random is predictable and unfit for security.
How do I generate a set of unique numbers?
Choose the integer-range mode, enable no-repeat, then set the bounds and count. The count can't exceed the number of integers in the range, or uniqueness becomes impossible.
Is the distribution uniform?
Yes. With a cryptographic source, every value in the range is equally likely, and long-run counts converge. But random doesn't mean "short-term even" — a streak of identical results is normal, not evidence of an unfair tool.