What Is a Secure Random Number Generator?
A secure random number generator uses the browser’s cryptographic source, so every number in the range is equally likely and unpredictable.
How to Use This Tool
- Enter supported integer minimum and maximum values.
- Choose how many results you need.
- Allow or disallow duplicates.
- Generate and copy the selected results.
How It Works
Cryptographic random bytes feed rejection sampling so mapping into the inclusive range does not introduce modulo bias. For distinct results, the requested count cannot exceed maximum − minimum + 1. Inputs and arithmetic must remain within the implementation’s exact integer bounds, with explicit resource limits.
Benefits and Use Cases
- Avoid predictable general-purpose random sources.
- Generate within an inclusive custom range.
- Prevent impossible distinct-result requests.
Security Best Practices
- Use supported integer bounds only.
- Do not assume random samples must look evenly spaced.
- Use dedicated credential generators for password-format requirements.
How Do I Read the Results?
Each result is independent unless you choose unique values.
Assumptions and Limitations
Not suitable for regulated lotteries or gambling that require certified hardware.
Related LogMeOnce Resources
Sources and Further Reading
Frequently Asked Questions
Are the endpoints included?
Yes; the minimum and maximum are both part of the requested inclusive range.
Why reject some random byte values?
Rejection sampling discards values that would otherwise make some results more likely than others.
Can random results repeat?
Yes; repetitions are normal when duplicates are allowed.
Can I request twenty distinct integers from one to ten?
No; that interval contains only ten distinct integers.
Is this based on Math.random?
Security-sensitive generation must use Web Crypto randomness rather than Math.random.
Published by LogMeOnce. Last updated November 27, 2026.
