Back to tools

Random Number

Generate Cryptographically Secure Random Numbers with Full Control

Reaching for Math.random() when you need a random number for a lottery draw, a statistics simulation, an A/B test split, or a security token is a mistake. That function is fast, but it is not cryptographically secure: it is seeded from the system clock or an internal state that an attacker can sometimes predict. A dedicated random number generator backed by the browser's crypto API draws from the operating system's entropy pool instead, so every value is unpredictable to anyone watching your machine. When the number decides who wins a prize or which user gets which variant, that difference matters.

The tool also removes the fiddly parts of generating numbers by hand: you set the minimum, the maximum, how many numbers you want, and whether duplicates are allowed. Need one number between 1 and 100? Set min to 1, max to 100, and count to 1. Need a lottery line of six unique values from 1 to 49? Set count to 6 and enable the unique option. Everything else, including the rejection sampling that keeps the distribution uniform, happens automatically.

How to Generate Numbers in Five Steps

  1. Enter the minimum value, for example 1, in the min field.
  2. Enter the maximum value, such as 100, in the max field.
  3. Set the count, like 5, to control how many numbers are produced.
  4. Toggle the unique option on when every result must be different.
  5. Press generate and copy the output, or regenerate for a fresh set.

Real Example: A Fair Lottery Draw

A classroom raffle needs five winners drawn from ticket numbers 1 to 50, with no ticket winning twice. Setting min to 1, max to 50, count to 5, and unique on produces one clean set in a single click.

InputOutput (example)
min=1, max=50, count=5, unique17, 3, 42, 9, 28
min=1, max=6, count=24, 6
min=0, max=1, count=100, 1, 0, 1, 1, 0, 0, 1, 0, 1

Tips for Using Random Numbers Well

When to Use This Tool

Frequently Asked Questions

Is the random number generator cryptographically secure?

Yes. Values come from the Web Crypto API, which draws from the operating system's entropy source, unlike Math.random().

Can I generate negative numbers?

Yes. The min field accepts negative values, so min=-10 with max=10 produces values across the full range.

What happens if I ask for more unique numbers than the range allows?

The tool rejects the request with a message, because a set of 60 unique values cannot fit in a range of only 50 integers.

Are the results truly uniform?

Yes. The generator uses rejection sampling so every integer in the range has an equal chance of appearing.

Do I need an internet connection?

No. All randomness is generated locally in your browser from your device's entropy, so nothing is sent to a server.

Can I use it for password generation?

For passwords, use the dedicated password generator instead; it combines the same secure source with length and character set controls.

Why should I avoid Math.random() for security?

Its output can be predicted when the internal state or seed is known, which makes it unsuitable for anything that must be unpredictable.

Can I generate a single number quickly?

Yes. Leave count at 1 and press generate; the tool returns one value instantly.