Generate one or more random numbers in a range using a secure random source.
Generates one or more random whole numbers within a range you set — for drawing a giveaway winner, rolling dice, picking a random sample, assigning an order, or seeding a game. It runs in your browser, so nothing you enter leaves your device.
Numbers come from your browser's Web Crypto random source (crypto.getRandomValues), not Math.random(). Random bytes are mapped onto your range with rejection sampling, so every value in the range is equally likely.
Math.random() is designed for speed, and the JavaScript specification leaves its algorithm up to each browser. The Web Crypto API is the interface browsers provide for security-sensitive randomness such as tokens and keys, so this tool uses that instead. A 32-bit random value is mapped onto your range by rejection sampling: any draw that falls in the uneven leftover slice at the top of the 32-bit span is thrown away and drawn again, which avoids the slight skew that a plain remainder (modulo) operation would add. For ranges wider than 232 the tool draws 53 random bits instead and applies the same rule.
For a public draw, that's the difference between “random” and “defensibly random”. For a serious prize, still record how you did it — screen-record the draw, or note the range and count — since the result itself can't be reproduced or audited afterwards.
Strictly, no — and for almost every use that doesn't matter. A true random number generator (TRNG) reads a physical process such as electrical noise or radioactive decay. A cryptographically secure pseudo-random generator (CSPRNG), which is what the Web Crypto API provides, stretches unpredictable seed entropy gathered by your operating system into a stream that can't be predicted without knowing its internal state.
Browsers use this same source to generate encryption keys, so it is more than random enough for giveaways, games, sampling and classroom draws. If you need certified physical randomness, for a regulated lottery for example, use a hardware generator or a service that publishes its entropy source.
The tool uses the browser interface defined in the W3C specification below. The rejection-sampling method is a standard technique we implemented ourselves.
Last reviewed: October 2026