Gerador de Números Aleatórios
Gere números inteiros aleatórios em um intervalo, com ou sem repetição, usando aleatoriedade criptográfica.
What is a Gerador de Números Aleatórios?
Generates random integers using crypto.getRandomValues() — the same cryptographically secure source of randomness the browser uses for security-sensitive operations — rather than Math.random(), which is fine for a game but has known statistical biases that matter for anything closer to a real draw, giveaway, or lottery pick.
How to use the Gerador de Números Aleatórios
- Set a minimum, maximum, and how many numbers you need
- Choose whether repeats are allowed
- The numbers are generated instantly, on your device, using the Web Crypto API
Formula
Result = min + (secure random integer mod (max − min + 1))
Each number is drawn using the Web Crypto API's cryptographically secure random source, then mapped into the requested range.
Example
Picking 5 unique raffle-ticket winners from a pool of 1–500 (min 1, max 500, count 5, repeats off) returns 5 distinct numbers with no duplicates — switch repeats on to simulate 5 independent dice-style rolls instead, where the same number can come up more than once.
Common mistakes
- Requesting more unique numbers than the range actually contains — e.g. 10 unique values from a range of only 5 possible numbers.
- Setting the minimum higher than the maximum, which is an invalid range rather than something the tool silently swaps.
- Entering a decimal for min, max, or count — this generator only produces whole numbers.
Frequently asked questions
Is this truly random, or just Math.random()?
It uses crypto.getRandomValues(), the Web Crypto API's cryptographically secure random number source — the same one browsers use for generating encryption keys — rather than Math.random(), which is faster but has documented statistical weaknesses that matter for anything closer to a real drawing or lottery pick.
Can I generate random numbers without repeats?
Yes — set "Allow repeats" to No and each number in the result is guaranteed unique, generated by shuffling the full range and taking the first N values rather than re-rolling and checking for duplicates.
Can I generate decimal (non-whole) random numbers?
No — this generates random integers only. For a random decimal, generate a random integer over a wider range and divide it, or scale it into the decimal range you need.
Is there a limit to how many numbers I can generate at once?
5,000 numbers per run — a cap that keeps the shuffle-based "no repeats" mode fast and prevents accidentally requesting an unreasonably large batch.
Is my numbers uploaded anywhere?
No — Gerador de Números Aleatórios runs entirely in your browser using JavaScript/WebAssembly. Your numbers is never sent to a server.