Gerador de Números Aleatórios
Gere inteiros ou decimais aleatórios em qualquer intervalo — na hora
Random Number Generator
Generate random numbers within a range
Set a min and max range
floor(random() x (max - min + 1)) + minWhat is a Random Number Generator?
A Random Number Generator (RNG) is a tool that produces numbers unpredictably within a range you choose. You set a minimum value and a maximum value, and the tool generates a random number between them. This is useful for games, picking winners, making random selections, simulating outcomes, and testing software.
Random number generators are often used to avoid bias when choosing something. For example, you can randomly select a number to decide a turn order, generate random quiz questions, pick a raffle winner, or create random test data for programming and spreadsheets.
Generator Options
This tool lets you set a Min and Max value and generates a random integer within that range. More advanced RNG tools may also support:
- Count-- how many random numbers to generate at once
- Decimals-- generate decimal numbers instead of integers only
- Unique numbers-- ensure no duplicates in the generated set
Most online RNG tools use a pseudo-random algorithm, which means the numbers are generated by a mathematical process that appears random. For everyday uses—like giveaways, classroom activities, games, and testing—this is more than sufficient.
How to Use This Random Number Generator
- Enter the minimum value (Min)-- the lowest number that can be generated
- Enter the maximum value (Max)-- the highest number that can be generated
- Click 'Calculate'-- to generate your random number
- Review the result-- a random integer within the specified range is displayed
- Generate again-- click Calculate again for a new random number each time
Tips:
- Make sure Min is less than Max—the tool needs a valid range to generate from
- If you enable unique numbers (on tools that support it), the count cannot exceed the size of the range (e.g., you cannot generate 20 unique integers from 1 to 10)
- Results will change each time you generate -- this is expected for a random tool
Formulas
Random Integer (Inclusive Range)
A basic way to generate a random integer between Min and Max (inclusive):
Random Integer = ⌊Random(0,1) × (Max − Min + 1)⌋ + Min
Random(0,1) -- a random decimal from 0 up to (but not including) 1
⌊ ⌋ -- floor function (round down)
Random Decimal (Continuous Range)
For generating decimal values within a range:
Random Decimal = Random(0,1) × (Max − Min) + Min
No floor function needed for decimal results
A Note on Randomness
Most online tools produce pseudo-random numbers using algorithms. For typical use (games, classroom, random picks, test data), this is perfectly fine. If you need cryptographic security (passwords, encryption keys), use a security-focused generator.
Example Calculations
Example 1: One Random Integer from 1 to 10
Min: 1, Max: 10
Output: any whole number: 1, 2, 3, …, 10
Example result: 7 (your result will vary)
Example 2: Five Random Integers from 100 to 200
Min: 100, Max: 200, Count: 5
Possible output: 112, 198, 145, 160, 101 (results vary)
Example 3: Three Unique Integers from 1 to 5
Min: 1, Max: 5, Count: 3, Unique: ON
Possible output: 2, 5, 1 (no repeats)
Example 4: Random Decimal from 0 to 1
Min: 0, Max: 1, Decimals: ON
Possible output: 0.3729 (results vary)
Frequently Asked Questions
Are the numbers truly random?
Most online random number generators use pseudo-random algorithms, which produce results that look random for everyday purposes. For games, raffles, and testing, they are typically sufficient.
Why do I sometimes see repeated numbers?
If 'unique numbers' is off, repeats are allowed. Even with randomness, repeats can occur naturally—especially when the range is small.
What does 'unique numbers' mean?
It means the generator will not repeat the same number in the output set. This is useful for picking distinct winners or creating non-duplicated selections.
What happens if Min is greater than Max?
The input is invalid. The tool will require you to correct the values. Always ensure Min ≤ Max.
Can I use this for passwords or security keys?
For security-sensitive use, you should use a cryptographically secure generator (often labeled 'secure random' or 'crypto-safe'). A general RNG is best for non-security uses like games, simulations, and random picks.
Want to add this random number generator to your website? Get a custom embed code that matches your site's design and keeps visitors engaged.
O que é um gerador de números aleatórios?
Um gerador de números aleatórios (GNA) produz números sem nenhum padrão previsível. Números aleatórios são usados em jogos (lançamento de dados, embaralhamento de cartas), amostragem estatística, simulações (métodos de Monte Carlo), criptografia e tomada de decisões (sortear um vencedor). Esta ferramenta gera números pseudoaleatórios usando a função criptográfica embutida do seu navegador, tornando os resultados imprevisíveis e sem viés para uso cotidiano.
Você pode gerar um único inteiro em qualquer intervalo — por exemplo, 1–6 para simular um dado ou 1–100 para uma loteria. Precisa de mais? Gere vários números de uma vez, escolha se repetições são permitidas ou alterne para o modo decimal para obter um valor entre 0 e 1 para experimentos de probabilidade e simulações.
Como usar o gerador de números aleatórios
- Defina os valores mínimo e máximo do seu intervalo (por exemplo, 1 e 100).
- Escolha quantos números gerar com um único clique.
- Selecione se valores duplicados são permitidos nos resultados.
- Clique em Gerar e copie seus resultados na hora.
Fórmulas e métodos
Inteiro aleatório em [min, max]:
floor(Math.random() × (max − min + 1)) + min
Decimal aleatório em [0, 1):
Math.random()
Decimal aleatório em [min, max):
Math.random() × (max − min) + min
Criptograficamente seguro (navegador):
crypto.getRandomValues(array)Math.random() é pseudoaleatório — ótimo para jogos e simulações, mas NÃO adequado para usos sensíveis como gerar senhas ou tokens. Para esses casos, use crypto.getRandomValues(), que obtém entropia do sistema operacional.
Casos de uso comuns
Simular um dado de 6 faces
Defina o intervalo de 1 a 6 e gere 1 número. Cada clique replica um lançamento justo de dado. Aumente a quantidade para lançar vários dados de uma vez.
Escolher 5 números de loteria
Defina o intervalo de 1 a 49, gere 5 números e desative as duplicatas. Você obterá cinco números únicos como em um sorteio de loteria real — sem repetições garantidas.
Decimal aleatório para simulação de probabilidade
Defina o intervalo de 0 a 1 no modo decimal. O resultado é um valor com distribuição uniforme entre 0 e 1, útil para simulações de Monte Carlo, experimentos de probabilidade e amostragem aleatória em estatística.