Random integers, dice rolls, UUID v4 and colors — generated securely in your browser with the Web Crypto API.
How the random generator works
True randomness matters whenever fairness or unpredictability is at stake, so this tool draws numbers from the browser’s crypto.getRandomValues API rather than the weaker Math.random(). For a range like 1 to 100 it uses rejection sampling — redrawing until the value falls inside the range — which guarantees every number is equally likely, with no subtle bias toward smaller values.
It can also roll dice, flip coins, generate UUID v4 identifiers, and produce random hex colors, all from the same secure source.
Common uses
- Games and giveaways — pick a fair winner from a list or roll dice without physical pieces.
- IDs and keys — generate UUIDs for databases, tests or sample data.
- Design — grab a random hex color to spark a palette.
- Decisions — let a coin flip settle a toss-up.
Frequently asked questions
Is it really random?
It uses a cryptographically secure generator, which is unpredictable enough for games, IDs and most non-security uses.
What is a UUID v4?
A 128-bit identifier with 122 random bits, formatted into a standard string. The chance of two colliding is astronomically small.
Can I use this for passwords?
For serious account security, use the dedicated Password Generator, which offers longer, configurable character sets. The random tool is fine for low-stakes picks.
Why rejection sampling?
Naively taking a remainder can make some numbers slightly more likely; redrawing until in-range removes that bias entirely.
Can I generate several numbers at once?
Yes. Set how many you need and the tool returns a list, each drawn independently from the secure source so the whole set is fair.
Are the dice and coin results fair?
Yes. Each roll or flip is drawn from the same secure random source with equal probability for every outcome, so the tool is suitable for casual games and decisions.
Why the source of randomness matters
There are two very different things a computer can hand you when you ask for a random number, and the difference is not cosmetic. The ordinary one, Math.random(), is a formula: given the same starting state it produces the same sequence, every time. That is fine for scattering particles in a game or picking a placeholder colour. It is not fine for anything where someone might have a reason to predict the answer.
The secure source, crypto.getRandomValues, draws from the operating system’s entropy pool, which is seeded by genuinely unpredictable physical events — timing jitter, interrupt noise, hardware sources. You cannot reproduce its output from a known seed, which is exactly the property you need whenever fairness or unpredictability is the point.
So: rolling dice for a board game, picking a giveaway winner, shuffling a playlist or generating an identifier are all cases where the secure source is the right one. It costs nothing extra, and it removes any question about whether the result could have been influenced.
Equal probability is harder than it looks
Drawing a number between 1 and 100 sounds like it should need no thought. It does, because of how the arithmetic works out. The secure API hands back a fixed-width integer — say a 32-bit value from 0 to 4,294,967,295. If you take that number modulo 100, you get something in range, but not evenly: the first 96 values in the cycle come up one extra time each, because 4,294,967,296 is not a multiple of 100. The bias is tiny, and it is real. Over enough draws, whoever holds the short end of it loses.
The fix is rejection sampling. Draw a value, and if it falls in the leftover slice that would cause the bias, throw it away and draw again. Every accepted value is then exactly equally likely. It costs a fraction of a microsecond and it is the difference between a generator that is fair and one that is merely almost fair.
- Random integer — uniform whole numbers within your bounds, via rejection sampling. Use the no-repeats option when you need a shuffle rather than independent draws.
- Dice roller — the same uniform draw mapped onto a die of any size, including the unusual ones tabletop games use.
- UUID v4 — a 128-bit identifier with 122 random bits. Collisions are not a practical concern; you would need to generate billions before the odds became interesting.
- Random colour — a random point in the RGB cube, useful for placeholders, chart series and palettes you would not have chosen yourself.
Where randomness is the wrong answer
A random string is a poor password. Randomness is not the problem — the alphabet is. Picking from sixty-four symbols produces something you cannot memorise and must store, and most people generate one and reuse it everywhere, which is worse than a long passphrase. If you need a password, use the dedicated generator with a length of sixteen or more; if you need something you can remember, use its passphrase mode.
Randomness is also not a substitute for a cryptographic key. If you are building something that signs, encrypts or authenticates, use a key derivation function and the platform’s own key APIs rather than assembling bytes yourself. The generator here is built for fair draws and identifiers, not for secrets that protect data at rest.
What each mode is good for
| Mode | Output | Use it for |
|---|---|---|
| Integer range | Whole numbers between limits | Draws, sampling, test data |
| Decimal range | Numbers with decimals | Simulations, proportions |
| No repeats | Each value once | Shuffling a list, picking winners |
| Dice | Standard die rolls | Games, probability teaching |
| List shuffle | Your items in random order | Order of play, assignment |