Random Number Generator — Free Online Integer & Decimal Generator
Generate random integers or decimals between any min and max. Batch mode makes lists of N numbers with or without duplicates. Optional cryptographically strong randomness via Web Crypto API. 100% local.
Last updated:
Set min, max, and how many to generate. Choose integer or decimal, allow duplicates or force unique. Optionally use cryptographically strong randomness (crypto.getRandomValues with rejection sampling — no modulo bias).
What is Random Number?
Random number generation looks simple but has real pitfalls. Naive `Math.floor(Math.random() * range)` is fine for a coin flip but suffers modulo bias when range doesn't evenly divide the underlying 2^32 output space — some numbers become slightly more likely than others. The crypto-strong mode of this tool avoids that with rejection sampling: it discards raw output that falls in the 'imbalanced tail' and resamples until the value is in a range that divides cleanly. For casual use (dice rolls, game randomness, sample data), the default Math.random path is fast enough. For anything security-adjacent (unique tokens, unbiased research samples), flip on the strong mode.
How to generate random numbers online
- 1Set the min and max — inclusive on both ends.
- 2Set how many to generate.
- 3Choose integer or decimal (with configurable decimal places).
- 4Toggle 'unique values only' for lottery-style draws, or 'cryptographically strong' for unbiased randomness.
Use Cases
Dice rolls / game randomness
d6, d20, whatever — set min=1, max=6, count=1. For a stat block, generate 6 numbers between 3 and 18.
Sample selection
Randomly pick user IDs from a range for a survey or A/B test bucketing.
Generate test fixtures
Batch-generate hundreds of random integers to seed a database or test suite.
Random unique tokens (integer form)
For IDs where you need integer uniqueness in a bounded space — 'pick 100 unique numbers between 1 and 1M'.
Key Concepts
- Modulo bias
- The distribution-skewing that happens when you take `randomInt() % N` where N doesn't divide the range evenly. Small skews are invisible in games but destroy statistical validity in security or research.
- Rejection sampling
- Discard raw random samples that fall in the biased tail and resample. Guarantees uniform distribution at the cost of occasional re-rolls. Standard fix for modulo bias.
Tips & Best Practices
- ▸Math.random() uses a linear congruential PRNG in most engines — perfectly fine for games, not for cryptography. crypto.getRandomValues uses OS-level entropy, suitable for tokens and keys.
- ▸The 'unique values only' path can't produce more values than the range allows. If you ask for 1000 unique in [1, 500], the tool will refuse and explain.
- ▸Modulo bias is real: `crypto.getRandomValues([0])[0] % 6` slightly favors 0-3 over 4-5 because 2^32 doesn't divide by 6. The crypto-strong mode uses rejection sampling to fix this.
- ▸For reproducible sequences (unit tests, benchmarks), seed a PRNG in code — this tool always uses fresh randomness.
Frequently Asked Questions
Can I generate random numbers without duplicates?
Yes — toggle 'Unique values only' and the tool draws from the range without replacement. If you ask for more unique values than the range allows, the tool tells you and stops instead of looping forever.
How strong is the randomness?
Two modes: standard uses Math.random (a non-cryptographic PRNG, fine for games and casual use), and 'cryptographically strong' uses crypto.getRandomValues with rejection sampling to eliminate modulo bias. Use the strong mode for anything security-adjacent.
What are the min / max limits?
Any integer within JavaScript's safe range (±9007199254740991). Decimal mode supports up to 15 significant digits — configurable decimal places from 0 to 10.
Can I use this for a fair lottery?
The strong mode is uniform and unbiased, but there's no audit trail. For legally-binding drawings use a certified source (random.org's signed drawings, or an on-chain VRF).
Related Tools
UUID Generator
Generate random UUIDs (v4) and time-ordered UUIDs (v7) online. Bulk generate up to 1000 at once and copy with one click.
Lorem Ipsum
Generate placeholder Lorem Ipsum text by words, sentences, or paragraphs. Perfect for mockups, wireframes, and design drafts.
Password Generator
Generate strong, random passwords with customizable length and character sets. All generation happens locally in your browser.
Random String
Generate one or many random strings of configurable length and character set. Toggle uppercase, lowercase, digits, symbols, or a custom alphabet. Optional exclude-ambiguous mode (0/O/1/l/I). Cryptographically strong by default. 100% local.
QR Code
Generate QR codes online for URLs, text, WiFi credentials, and more. Download as PNG or SVG. Everything runs locally.
JSON Formatter
Format, beautify, and validate JSON online. Free, fast, and 100% local — your data never leaves your browser.