Random Generator
Numbers, names, colours, dice, picks
Cryptographically strong randomness for integers, decimals, strings, colours, dates, dice and list picks.
Random Generator
Runs in your browser · nothing uploadedNothing drawn yet.
drawn with crypto.getRandomValues
01 — How to use Random Generator
02 — Getting good results
03 — Questions
No. Values are generated in this browser tab and displayed. Nothing is transmitted or stored, so a draw cannot be observed or reproduced afterwards by anyone, including this site.
The source is crypto.getRandomValues, the browser's cryptographically secure generator, and integers are drawn with rejection sampling so every value in the range is exactly equally likely. What it cannot give you is an audit trail — nothing is recorded, so you cannot later prove to a third party what was drawn.
A seed makes results reproducible, which requires a deterministic pseudo-random generator. That is the opposite of drawing from the cryptographic source, and offering both would mean the "crypto" claim was sometimes untrue. Unpredictability was the more useful property to keep.
Because there are only 50 of them. Without repeats, the most you can draw is the size of the range — the error names both numbers so the fix is obvious.
04 — More about Random Generator
Why Math.random is not used here
JavaScript's Math.random is specified only as "an implementation-dependent algorithm or strategy" producing values with approximately uniform distribution. It is explicitly not required to be unpredictable, and in practice engines implement it with a fast non-cryptographic generator whose internal state can be recovered from a modest number of observed outputs. For a loading animation that is entirely fine. For anything anyone might treat as fair or secret — a prize draw, a token, a password, a shuffled deck in a game with stakes — it is the wrong tool, and the failure is silent: the numbers look random right up until someone predicts them. crypto.getRandomValues is seeded by the operating system's entropy pool and is designed to resist exactly that, which is why every mode here draws from it.
Uniformity and the modulo trap
Getting a random number in a range is where most implementations quietly go wrong. The natural approach — take a random value and use the remainder after dividing by the range — produces a subtly uneven distribution whenever the range does not divide the generator's output space evenly, because the leftover values at the top map back onto the bottom of the range. With a 256-value byte and a range of ten, the first six numbers come up about 17% more often than the last four. Rejection sampling avoids it completely: draw, and if the value lands in the incomplete final block, throw it away and draw again. The cost is an occasional extra draw; the benefit is a distribution that is exactly uniform rather than merely close, which is what "fair" has to mean for a draw.
61 more tools
where this came from.
Same shell, same shortcuts, same promise: nothing leaves your browser.