Random Number Generator
Generate random numbers between any range. Integer or decimal, single or batch, unique or repeating.
What is a random number generator?
A random number generator (RNG) produces numbers that cannot be predicted from the sequence. True randomness comes from physical phenomena (radioactive decay, atmospheric noise) - typically only available in specialized hardware. Most software RNGs are 'pseudo-random' - they use mathematical algorithms that produce sequences that LOOK random but are actually deterministic from a starting 'seed'. JavaScript's Math.random() (used in this tool) is pseudo-random and adequate for: games, simulations, statistical sampling, picking random winners, generating sample data. For cryptographic uses (passwords, encryption keys, tokens), use a cryptographically-secure RNG like our Password Generator's crypto.getRandomValues().
How to use this tool
- Set range — Minimum and maximum values. Negative numbers allowed (e.g. min -100, max 100). Default 1-100.
- Set quantity — How many numbers to generate. 1 to 10,000.
- Choose type — Integer (whole numbers) or decimal (with decimal places).
- Optional: no duplicates — Only for integers in finite range. Useful for raffles, ticket numbers, sampling without replacement.
- Optional: sort ascending — Display results in order. Useful for inspection or when order doesn't matter.
- Click 'Generate' — Random numbers appear in output box. Click Copy to put on clipboard.
How it works
The tool uses JavaScript's Math.random() which produces a uniformly distributed pseudo-random number between 0 and 1 (exclusive).
For integers in [min, max]:
result = floor(Math.random() × (max - min + 1)) + min
For decimals in [min, max]:
result = Math.random() × (max - min) + min
For unique integers (no duplicates), the algorithm:
- Generates the full pool of possible integers
- Repeatedly picks a random index, takes that number out of the pool
- Continues until the requested count is reached
This guarantees all results are unique. If count exceeds pool size (e.g. 5 unique from range 1-3), the tool shows an error.
Examples
- Pick a random number 1-100: e.g. 42
- 10 unique numbers from 1-20 (sampling): e.g. 3, 7, 12, 5, 18, 9, 14, 1, 20, 11
- 1000 random decimals 0-1 for statistical simulation: 0.234, 0.891, 0.456, ...
- Lottery draw - 5 unique numbers from 1-49: simulates traditional lotto
- Random temperature for testing: integer between -40 and 50 (°C range)
- Random dice rolls (5d6): 5 numbers, range 1-6, integer, with duplicates allowed
Tips & best practices
- For cryptographic uses (passwords, tokens, secrets), use our Password Generator instead - this tool's randomness is not cryptographically secure
- Math.random() in browsers is good enough for games, statistical sampling, and most general purposes
- Don't use for serious gambling or any application where predictability could cause harm
- If you need numbers from a non-uniform distribution (Gaussian, Poisson, etc.), this tool doesn't support that - use specialized statistical libraries
- For 'pick a winner' use case, generate ONE number and trust the result - don't keep re-rolling until you like the outcome (that's not random)
- Use the 'sort ascending' option for inspection, but the order shouldn't matter for true randomness
- Browser-generated random numbers are seeded from system entropy - different from session to session
Limitations & notes
Math.random() is pseudo-random, NOT cryptographically secure. For passwords, tokens, encryption keys, or any security purpose, use cryptographic RNG (Web Crypto API's getRandomValues). For high-precision statistical work (Monte Carlo simulations needing thousands of independent samples), library RNGs (Mersenne Twister, PCG) may be preferred over browser Math.random(). The tool doesn't seed - results are different each session.
Frequently Asked Questions
Is this true random?
Pseudo-random - it's a mathematical algorithm seeded from system state. For all practical purposes (games, simulations, statistical sampling), it's indistinguishable from true random. For cryptographic use (passwords, tokens), use a crypto-secure RNG instead.
Can I generate the same sequence again?
No - each generation uses different system state for seeding. There's no 'seed' input. If you need reproducible results (e.g. for testing), use a library like seedrandom.js or Math.seedrandom() polyfill.
What's the maximum number I can generate?
JavaScript's Number type can represent integers safely up to Number.MAX_SAFE_INTEGER = 9.007199254740991 × 10^15. Larger numbers may lose precision. For practical use, anything under a billion is fine.
Why can't I generate negative numbers in unique mode?
You can - just set min to a negative value. The unique mode generates from any integer range. The constraint is that you can't request more unique numbers than exist in the range.
Does this tool work offline?
Yes - once the page loads, all generation happens locally in your browser. No internet needed for the generation itself.
Can I use this for lottery games?
Yes - set range and count, enable 'no duplicates' for ball-drawing simulations. Just remember pseudo-random isn't true random - for real lottery operations, regulators require certified RNGs.
Why does 'no duplicates' option only work for integers?
Decimals between any two numbers contain infinite possible values - 'uniqueness' is statistically meaningless (two random decimals are almost certainly different). Unique mode only makes sense when there's a finite pool to sample from.
