Random Number Generator
Generate secure random numbers in any range.
Click Generate to produce random numbers using
crypto.getRandomValues()Uses for random numbers
- Lottery / raffle — fair random draws for giveaways
- Dice simulation — tabletop games, probability experiments
- Random sampling — picking random items from a list for testing
- Password seeds — generating random PIN codes or OTPs
- Education — statistics exercises, probability demonstrations
- Games — random card shuffles, team assignments
Math.random() vs crypto.getRandomValues()
Math.random()uses a deterministic pseudorandom algorithm seeded at startup. For most games and simulations it's fine. But crypto.getRandomValues()draws from the OS entropy pool — the same source used for cryptographic key generation. This tool always uses the secure version.
Frequently asked questions
- Is this truly random?
- This generator uses crypto.getRandomValues() — the browser's cryptographically secure pseudorandom number generator (CSPRNG). It is significantly more random than Math.random() and suitable for security-sensitive applications.
- What does 'no duplicates' do?
- When enabled, each number in the output appears only once — like drawing numbers from a hat without replacement. This uses a Fisher-Yates shuffle on the full range. Note: you cannot generate more unique numbers than there are integers in the range.
- What is the maximum number of values I can generate?
- You can generate up to 1,000 random numbers at once. For most use cases (lottery picks, random sampling, dice simulation) this is more than sufficient.
- How do I simulate a dice roll?
- Set Min to 1 and Max to 6 for a standard die. For multiple dice, increase the count. For a D20 (used in tabletop games), set Min to 1 and Max to 20.
- Can I use this for a lottery or raffle?
- Yes. Set Min to 1 and Max to your lottery range (e.g., 49 for UK Lotto), enable No Duplicates, and set count to the number of balls drawn (e.g., 6). This gives a fair random draw.
Related tools
- JSON Formatter
Format, beautify, minify, and validate JSON in your browser
- QR Code Generator
Generate QR codes for URLs, text, Wi-Fi, and more. Download as PNG.
- Password Generator
Generate strong, random passwords with custom length and character sets.
- Base64 Encoder / Decoder
Encode text to Base64 or decode Base64 back to plain text.
- URL Encoder / Decoder
Encode or decode URLs and query strings with percent-encoding.