Gerador de Número Aleatório (faixa)
- Created by
- Renato Passos, Eng. de Software
- Reviewed by
- Renato Passos, Eng. de Software
Last updated: Apr 18, 2026
Formula
LCG (a=48271, m=2³¹−1)
About this calculator
The Random Number Generator is a tool that produces pseudo-random numbers within a user-defined range. Unlike true random generators based on physical phenomena, this generator uses a deterministic algorithm known as LCG (Linear Congruential Generator), with specific parameters (a=48271 and m=2³¹−1). This means that for the same initial seed, the generated sequence will always be identical, which is useful for tests and simulations requiring reproducibility.
The operation is simple: the user sets a minimum and maximum value, and the tool returns an integer within that range. The seed can be entered manually or generated automatically (e.g., based on time). The LCG algorithm is widely used due to its efficiency and ease of implementation, but it is not suitable for cryptographic applications or where total unpredictability is required.
This calculator is useful in various everyday and professional situations: from deciding a number for a simple raffle, generating numbers for board games, to performing basic statistical simulations or creating random examples for educational purposes. Because it is deterministic, it is ideal for those who need to repeat an experiment with the same numbers.
It is important to remember that pseudo-random numbers are not truly random. If you need randomness with security (such as in lotteries or cryptography), this generator is not recommended unless the seed is unpredictable and has high entropy. Additionally, for very large ranges or applications requiring strict statistical uniformity, more sophisticated algorithms may be necessary.
Frequently asked questions
Can I use this generator for a prize draw at an event?
Yes, for simple raffles where security is not critical, the generator works fine. But remember that the result depends on the seed: if it is known or predictable, someone could reproduce the same number.
How do I choose the seed to ensure different results each time?
Leave the seed field empty so the tool uses an automatic seed based on time (milliseconds). This produces different results each run.
Is the generated number truly random?
No. It is pseudo-random, meaning it is generated by a deterministic algorithm. For most everyday uses it is sufficient, but not for cryptography or regulated gambling.
Can I generate decimal numbers?
Currently the generator only returns integers. If you need decimals, you can divide the result by a power of 10, but there is no direct support.
What is the maximum supported range?
The maximum range is limited by the algorithm, which operates with 32-bit integers. In practice, you can set min and max within a range up to 2³¹−1 (about 2.1 billion).