Numbers & calculations
Random number
Let chance choose. Pick a whole number between your limits.
How it works
Random number
Enter a minimum and a maximum. Both endpoints can be drawn. Web Crypto supplies randomness with rejection sampling to avoid modulo bias.
How to use this tool
- Enter the smallest and largest allowed integer, then Generate. Both endpoints are included.
- Generate again for another draw. Equal bounds always return that number; repeated draws may return the same value.
Understanding the result
The browser's cryptographic random source provides bytes. Rejection sampling avoids bias from reducing a random value into an interval of arbitrary size.
Worked examples
7…7 → 7
1…6
−5…5
Good to know
Integers from −1,000,000,000 to 1,000,000,000. For everyday use, not certified lotteries or regulated draws.
Bounds must be integers from −1,000,000,000 to 1,000,000,000 and minimum must not exceed maximum. This is not a certified lottery, password tool or draw without replacement.
A few quick answers
Why did I get the same number twice?
Each draw is independent. Repetition is possible and is not evidence that the generator is broken.
Sources and implementation
Implementation for this tool: crypto.getRandomValues · rejection sampling
Maintained by Chpl Limited · Updated: