🔒 All processing happens in your browser. No data is sent to any server.
FREE

Random Number Generator

← All Tools
Random Number in a Range
Press Generate to see results

What is Random Number Generator?

Random Number Generator generates truly random numbers (using the browser's cryptographic random number API) for any range, in any quantity. Generate a single number, a list of unique random numbers, a random sequence, random hexadecimal strings, random floats, or roll simulated dice (d4, d6, d8, d10, d12, d20). All numbers are generated client-side using the Web Crypto API, not a server-side random source.

Cryptographically secure random number generation (CSPRNG) uses entropy from hardware sources (CPU timing jitter, hardware noise) to produce numbers that are statistically indistinguishable from true random. The browser's crypto.getRandomValues() API provides CSPRNG — unlike Math.random(), which uses a deterministic algorithm that produces pseudorandom (predictable, if seeded) output. This tool uses the secure API.

Applications for random numbers: security (generating passwords, cryptographic keys, salts), gaming (dice rolls, card shuffles, lottery draws), statistics (random sampling from a population), scientific simulation (Monte Carlo methods), and decision-making (picking a random item from a list, selecting a random winner in a giveaway).

How to Use

  1. Enter the minimum and maximum range for your random number (e.g., 1 to 100).
  2. Set the count field to generate multiple numbers at once.
  3. Toggle 'Unique' to ensure no duplicates in a multi-number generation.
  4. Use the Dice section to roll any standard tabletop dice: d4, d6, d8, d10, d12, d20, d100.
  5. Click Generate again to get new numbers without refreshing the page.

Examples

Pick a winner from 100 entries

Result: Range: 1 to 100, Count: 1 → Random number: 47 — assign each entry a number, pick #47

Roll 3d6 for a D&D stat

Result: Dice: 3 × d6 → Rolls: 4, 3, 6 = Total: 13

Generate a random hex color

Result: 6-digit hex → #3A7FD5 — use as a random UI accent color or for testing

Frequently Asked Questions

What is the difference between random and pseudorandom?

True random numbers come from unpredictable physical phenomena (radioactive decay, thermal noise, atmospheric noise). Pseudorandom numbers come from a deterministic algorithm seeded with an initial value — given the same seed, the sequence is identical. This tool uses crypto.getRandomValues(), which collects hardware entropy (CPU timing, OS events) for cryptographically secure randomness.

Is Math.random() cryptographically secure?

No. JavaScript's Math.random() uses a deterministic pseudorandom generator (typically xorshift128+). While fast, it is not suitable for security applications (passwords, keys, tokens) because the output is predictable if you know the internal state. For security: always use crypto.getRandomValues() or the Web Crypto API.

How do I pick a random winner fairly?

Assign each participant a number from 1 to N. Generate a random number in that range using a CSPRNG (this tool). The participant with that number wins. For verifiable fairness: commit to the random seed before entries close (publish a hash of the seed), then reveal the seed after. This proves the winner was determined by a seed chosen before entries were received.

What is a random salt and why is it needed?

A salt is a random value added to a password before hashing, ensuring that the same password produces a different hash each time. Without salts, identical passwords have identical hashes — a precomputed rainbow table can look up all of them at once. With a unique 128-bit random salt per password, each hash is unique and rainbow tables are defeated.

Can truly random numbers repeat?

Yes — by definition, random means any value is equally likely on each draw. In a range of 1-100, there is always a 1% chance of repeating the previous number. 'Unique' mode in this tool generates a sequence without repetition (sampling without replacement) — but that is not the same as random with no repeats naturally.

Related Tools