Random Number Generator
Generate cryptographically secure random numbers in any range. Set the count, decimal places, and optionally prevent duplicates — then copy or download your results.
How Random Numbers Are Generated
This tool uses crypto.getRandomValues() — the browser's Web Crypto API — to generate random numbers. Unlike Math.random(), which uses a deterministic algorithm, the Web Crypto API is seeded by the operating system's entropy pool (hardware events, interrupt timing, and other unpredictable sources). This makes the output genuinely unpredictable and suitable for security-sensitive applications.
Use Cases
- Lottery and raffle draws: Enable no-duplicates and set your number range
- Statistical sampling: Generate random samples from a population range
- Games and simulations: Dice rolls, card draws, random events
- Random ordering: Generate unique numbers to shuffle a list
- Testing and development: Seed data, random IDs, test inputs
- Decision making: Pick a random number to break a tie or make a choice
Integers vs Decimals
Set Decimal places to 0 to generate whole integers. Increase it to generate floating-point numbers with up to 10 decimal places. For example:
- Min: 1, Max: 6, Decimals: 0 → simulates a dice roll
- Min: 0, Max: 1, Decimals: 4 → random probability between 0 and 1
- Min: 0, Max: 100, Decimals: 2 → random percentage with two decimal places
No Duplicates Mode
When "No duplicates" is enabled, the generator uses a Fisher–Yates shuffle over the integer range to ensure each number appears at most once. This requires:
- Integer mode (decimal places = 0)
- Count ≤ (Max − Min + 1)
This is ideal for lottery picks, random sampling without replacement, or generating unique IDs within a bounded range.
Frequently Asked Questions
Is this random number generator truly random?
Yes. Numbers are generated using the Web Crypto API (crypto.getRandomValues()), which provides cryptographically secure pseudorandom numbers sourced from the operating system's entropy pool. This is the same source used by security-critical applications and is far more random than Math.random().
What is the difference between this and Math.random()?
JavaScript's Math.random() uses a deterministic pseudorandom algorithm that is fast but not cryptographically secure — its output can potentially be predicted. crypto.getRandomValues() is seeded by the OS entropy pool (hardware events, interrupt timing, etc.), making it unpredictable and suitable for security use cases.
Can I generate floating-point (decimal) numbers?
Yes. Set 'Decimal places' to 1 or more to generate decimal numbers. For example, with min=0, max=1, and 4 decimal places you get values like 0.3847.
What does 'No duplicates' mean?
When enabled, each generated number appears only once in the results. This is useful for lottery draws, random sampling, or shuffling. Note that no-duplicates mode only works for integers — the range must be large enough to contain at least as many integers as the requested count.
How many numbers can I generate at once?
Up to 1,000 numbers per generation. For larger batches, use the Download button to save results as a text file.
Can I use this for lottery or raffle picks?
Yes. Enable 'No duplicates', set your range (e.g. 1–49 for a lottery), set the count to the number of picks you need, and click Generate. Each result will be unique within the range.