Random Number Generator
GeneratorsGenerate random integers or decimals within any range, with uniqueness, distribution options, and cryptographically strong output.. Free, private — all processing in your browser.
The Random Number Generator produces random integers or decimals within any range you specify. Set min, max, count, and whether you want integers or decimals, and the tool returns your requested random values. Use for simulations, test data, raffles, dice-rolling, lottery-number picking, sampling from a dataset, Monte Carlo methods, or any task needing unpredictable numbers.
Output is cryptographically strong by default (via crypto.getRandomValues) with an option to use Math.random for non-security contexts where speed slightly beats strength. Bulk mode generates up to 10,000 numbers at once with optional uniqueness (great for lottery-style picks without replacement). Seeded mode gives reproducible sequences for debugging and testing. Distribution options include uniform (default, every value equally likely), normal (Gaussian bell curve), and weighted (specify probabilities per value). Everything runs in your browser — seeds and generated numbers never leave your machine.
Random Number Generator — key features
Cryptographically secure
Uses crypto.getRandomValues by default; suitable for raffles, secure sampling, and any security-relevant randomness.
Integer or decimal
Generate whole numbers or floating-point values with configurable precision.
Custom range
Min and max can be any numbers, positive or negative, with any magnitude.
Bulk generation
Generate up to 10,000 numbers at once for sampling, test data, or simulation.
Unique values option
Sampling without replacement — useful for lottery picks or dealing cards.
Distribution options
Uniform (default), normal/Gaussian, or weighted distributions for Monte Carlo and statistics.
Seeded reproducibility
Optional seed for deterministic sequences useful in testing and debugging.
Client-side only
No random number leaves your browser.
How to use the Random Number Generator
- 1
Set range
Enter min and max values for your random output.
- 2
Choose type
Integer (whole numbers) or decimal (floating-point).
- 3
Set count
How many numbers to generate (1 to 10,000).
- 4
Optional — enable unique
For sampling without replacement (lottery picks, dealt cards).
- 5
Generate and copy
Click generate, copy results as list, CSV, or JSON.
Common use cases for the Random Number Generator
Games and raffles
- →Dice rolling: Generate a single random integer 1-6 or 1-20 for tabletop games.
- →Lottery numbers: Pick 6 unique numbers from 1-49 with uniqueness enabled.
- →Prize drawing: Pick random participant indices for a fair drawing with cryptographically strong randomness.
Development and testing
- →Test data: Generate random ages, prices, or IDs for filling test databases.
- →Load testing: Create varied random inputs to test application behavior under load.
- →Fuzz testing: Generate random numeric inputs to find edge cases and bugs.
Statistics and science
- →Monte Carlo simulation: Generate bulk random samples for Monte Carlo methods in finance or physics.
- →Random sampling: Select a representative sample from a larger population for survey or analysis.
- →Bootstrap estimation: Resample data with replacement to estimate statistical confidence intervals.
Random Number Generator — examples
Dice roll
Single random integer 1-6.
min: 1, max: 6, count: 1
4 (example; varies each generation)
Lottery
6 unique numbers from 1-49.
min: 1, max: 49, count: 6, unique
7, 13, 22, 31, 38, 44
Percentage
Random decimal 0-1.
min: 0, max: 1, decimal
0.4726831 (approximately)
Bulk integers
100 integers 0-99 for test data.
min: 0, max: 99, count: 100
list of 100 numbers, each 0-99 uniform random
Normal distribution
Bell-curve samples.
mean: 50, stddev: 10, count: 1000
1000 samples following normal distribution, clustered around 50
Technical details
Random integer in range: use (crypto random as 0-1 float) × (max - min + 1) + min, then floor. This gives a uniform distribution where every integer in the range is equally likely.
To avoid modulo bias with byte-level randomness: rejection sampling. Generate a random 32-bit integer; if it is outside the acceptable range, reject and try again. This preserves exact uniformity at the cost of occasional retries.
Random decimal in range: (crypto random as 0-1 float) × (max - min) + min. Provides roughly 52 bits of floating-point precision (IEEE 754 double).
Uniqueness (sampling without replacement): use Fisher-Yates shuffle on a range array and take the first N values. Or use a Set-based approach that rejects duplicates during generation.
Seeded random: for reproducibility, use a seeded pseudo-random generator like mulberry32 or xoshiro. Seeded random is not cryptographically secure but is reproducible, useful for testing and debugging.
Normal distribution: Box-Muller transform takes two uniform random samples and produces two normally distributed samples with mean 0 and standard deviation 1. Shift and scale to any mean/stddev.
Weighted random: specify weights for each option. Sum weights, pick a random value in [0, total). Iterate options, subtracting weight from random value until it goes negative — that is the selected option. O(n) per selection but handles any weight distribution.
Bulk uniqueness: when generating many unique numbers, memory usage scales with count. For millions of numbers in a huge range, this is fine (you just need indices). For unique numbers in a small range, you can\u2019t have more than the range size.
Performance: generating 10,000 cryptographic random integers takes around 50-100 ms. Math.random-based is about 10x faster but not cryptographically strong.
Common problems and solutions
⚠Math.random for security
Math.random is predictable by design. Never use it for security-sensitive randomness (tokens, cryptographic salts). Always use crypto.getRandomValues for those — the tool default.
⚠Off-by-one errors
Inclusive vs exclusive bounds. A range 1-6 can mean [1, 7) or [1, 6]. The tool treats both min and max as inclusive by default. Double-check when translating to other languages where conventions differ.
⚠Floating-point imprecision
Decimal random numbers may have many decimal places. For human-readable output, round to your desired precision; the tool supports this.
⚠Modulo bias
Naive (rand % max) produces slight bias. The tool uses rejection sampling to avoid this, but know that ad-hoc random code elsewhere may have subtle bias.
⚠Exhausting a small range
Generating more unique numbers than the range size is impossible. 10 unique numbers from 1-5 cannot all be unique. The tool warns and truncates.
⚠Biased randomness from insufficient entropy
Without a real RNG source, seeded random in a loop can exhibit patterns. Use cryptographic random for serious applications; seeded random is for reproducibility, not quality.
⚠Normal distribution extremes
Normal distribution theoretically has infinite tails — very occasionally you’ll see extreme values (many standard deviations from the mean). If this causes problems, clip the output to a reasonable range.
Random Number Generator — comparisons and alternatives
Compared to programming language built-ins, this tool is the interactive version with uniqueness, distributions, and entropy already handled. For automation, use Python\u2019s secrets or JavaScript\u2019s crypto API in code.
Compared to online dice or lottery tools, this one is more flexible (any range, any count) and uses cryptographic randomness by default. Simple dice tools fix the range; this one doesn\u2019t.
Compared to spreadsheet RAND or RANDBETWEEN, this tool handles cryptographic strength, uniqueness, and larger batches. Spreadsheets are better for mixing random numbers with other formulas; this tool is for pure random generation.
Frequently asked questions about the Random Number Generator
▶How do I generate a random number in a specific range?
Enter min and max, click generate. The tool returns an integer or decimal in [min, max] inclusive. Both endpoints are possible values (e.g., range 1-6 can produce 1 or 6).
▶Is the random number secure?
By default yes, using crypto.getRandomValues which taps the operating system’s secure random generator. Suitable for raffles, security tokens (when combined with string encoding), and any context where predictability would be harmful.
▶Can I generate unique random numbers?
Yes, enable the uniqueness option. The tool generates numbers without replacement — each result is different from the previous ones. Useful for lottery-style picks, dealt cards, or sampling without replacement.
▶What is the difference between uniform and normal distributions?
Uniform distribution means every value in the range is equally likely — flat probability. Normal (Gaussian) distribution clusters around a mean with a bell-shaped curve — values near the mean are much more likely than extremes. Pick based on what you are modeling.
▶Can I reproduce the same sequence?
Yes, enter a seed value and the same seed always produces the same sequence. Useful for testing (where you want reproducible random inputs) and debugging. Seeded random is not cryptographically secure, but reproducibility is its point.
▶How many random numbers can I generate at once?
Up to 10,000 per batch. For very large datasets, generate multiple batches. The tool runs in your browser so truly enormous generation may slow the tab.
▶Is this suitable for scientific simulation?
For most Monte Carlo and statistical simulation, yes. The cryptographic random is actually more than needed for statistics (non-crypto PRNGs are usually fine for stats). For very large simulations, consider a dedicated numerical computing environment (NumPy, R) that may be faster.
▶Is my data private?
Yes. All random generation runs in your browser. Seeds, generated numbers, and configurations stay local.
Additional resources
- MDN crypto.getRandomValues — Browser API for cryptographically strong random values.
- NIST random bit generation — US government standards for random number generation quality.
- Wikipedia — Pseudorandom number generator — Background on different types of random number generators.
- random.org — True random number service using atmospheric noise, for when hardware randomness is not enough.
- Python secrets module — Python’s standard library for cryptographically strong random numbers.
Related tools
All GeneratorsBcrypt Hash Generator
Hash passwords with bcrypt and verify existing hashes — configurable rounds
Byte Converter
Convert digital storage units between bytes, KB, MB, GB, TB, PB with support for both binary (base-1024) and decimal (base-1000) conventions.
Fake Data Generator
Generate realistic fake test data — names, emails, addresses, phones, dates, UUIDs, and more — for development and demos.
Hash Generator
Generate MD5, SHA-1, SHA-256, SHA-512 hashes for text and files
HMAC Generator
Generate HMAC signatures (SHA-256, SHA-512) for API auth and webhook verification
JWT Generator
Create signed JSON Web Tokens (JWT) with custom claims — HS256, RS256, ES256
Learn more
Explore more tools
200+ free tools that run in your browser.
Browse all tools →