Skip to main content

Random number generator (draws, dice, lottery)

Random number generator: minimum and maximum, quantity up to 1,000, integers or decimals, draws without repeats. Randomness from the browser's Web Crypto API, handy for raffles, dice, lottery picks and sampling.

  • Clipboard

Embed this widget

Customize the result, check the live preview, then copy the code.

Preview

Embed code type

Code to copy

Responsive and automatically resized by Bethemesh.

Generation settings

Quick ranges

Generation options

123
1×

Was this tool useful?

How does this tool work?

Choose a range, a quantity and a type of value, and the tool draws the numbers at once. Use it for a raffle among numbered participants, a dice roll, lottery picks, a sample from a numbered list or test data. Draws without repetition (unique values) are supported too.

You set a minimum, a strictly greater maximum and a quantity from 1 to 1,000. In integer mode every number is drawn with equal probability among the integers of the range, limits included: between 1 and 6, each face has a 1 in 6 chance. In decimal mode the value is drawn uniformly in the real interval, with the full precision of a floating-point number.

Randomness comes from the browser's Web Crypto API (crypto.getRandomValues), a cryptographic-quality generator, not from Math.random, which can be predictable. The 53 random bits it supplies are used to build a uniform number between 0 and 1; mapped onto a range of n integers, the leftover bias stays below n ÷ 2^53, negligible in practice.

With "unique values", a number already drawn is discarded: this is drawing without replacement, like lottery balls. The range must then hold at least as many integers as values requested (from 1 to 5 you cannot draw 6 unique values). Without it, repeats are possible: in 100 draws between 1 and 100, the chance that a given number appears at least once is about 63.4%.

A cryptographic draw is not a password generator: values are shown on screen and copied in plain text. For a secret, use the password generator. For a fair raffle, make sure each participant has one unique number in the range.

How to use this tool

  1. Set the limits

    Minimum and maximum, with the maximum greater than the minimum. For a six-sided die: 1 and 6; for a 49-number lottery: 1 and 49.

  2. Set quantity and type

    From 1 to 1,000 values, integers or decimals. Turn on unique values for a draw without replacement.

  3. Generate and copy

    Each click draws a fresh set. If the range is too small for unique values, a message says so.

Probabilities in a random draw

For n equally likely values, every value has the same chance.

Probability of a given number

P = 1 ÷ n, with n = max − min + 1

n is the number of integers in the range, limits included.

Combinations of k unique values

C(n, k) = n! ÷ (k! × (n − k)!)

Number of different draws of k numbers from n, ignoring order.

At least one appearance in k draws with replacement

P = 1 − (1 − 1 ÷ n)^k

Probability that a given number comes up at least once.

n
number of possible values in the range
k
number of draws or requested values
P
probability (between 0 and 1)

Example: in a 6-from-49 lottery, C(49, 6) = 13,983,816 combinations, so one chance in 13,983,816. To get at least one 6 in 4 die rolls, P = 1 − (5 ÷ 6)^4 ≈ 51.77%.

Use cases

Raffles

Pick a winner or a speaking order among numbered participants, without visible bias.

Games and dice

Replace a die, a coin (1 or 2) or a lottery slip for a game or practice.

Sampling

Pick random rows from a numbered file for a quality check or an audit.

Tests and simulations

Produce test values, dummy IDs or draws for a simple simulation.

Examples

Rolling a die

Each face is equally likely: 1 in 6, about 16.67%.

Input

min 1, max 6, quantity 1, integers

Result

one integer from 1 to 6

6-from-49 lottery ticket

There are 13,983,816 ways to choose 6 numbers from 49, so one chance in 13,983,816 of matching the draw.

Input

min 1, max 49, quantity 6, integers, unique

Result

6 distinct numbers between 1 and 49

Raffle with 3 winners

With 100 numbered participants, nobody can be drawn twice.

Input

min 1, max 100, quantity 3, integers, unique

Result

3 different participant numbers

Decimal test data

Useful to simulate probabilities or fill a dummy dataset.

Input

min 0, max 1, quantity 5, decimals

Result

5 decimal numbers between 0 and 1

Range too small

Only 5 integers exist, so 6 distinct ones cannot be drawn.

Input

min 1, max 5, quantity 6, unique

Result

error message

Tips and best practices

  • For a coin, draw 1 or 2; for a die, 1 to 6; for a percentage, 1 to 100.
  • With two dice, draw two values from 1 to 6: their sum is not uniform (7 is the most common).
  • Number every participant before the raffle and keep the list so you can justify the result.
  • For unique values, the quantity must not exceed the number of integers in the range.
  • For passwords or keys, prefer a dedicated generator.

Sources and references

Frequently asked questions

Are the numbers truly random?

They come from the browser's cryptographic generator (crypto.getRandomValues), unpredictable in practice, with 53 bits of precision. It is not a physical draw, but it is better than Math.random.

What is the probability of drawing a specific number?

It is 1 ÷ n, where n is the number of integers in the range: 1 in 100 (1%) between 1 and 100, 1 in 6 (16.67%) for a die.

How do I draw without duplicates?

Turn on "Unique values". The range must hold at least as many integers as values requested, or an error message appears.

How many numbers can I generate at once?

Up to 1,000 per draw. Larger quantities are capped at 1,000.

Can I draw decimal numbers?

Yes: turn off the integers option. Values are spread uniformly between the two limits.

Related tools

Tools similar or complementary to this one.

Similar tools

Generate strong random passwords from 8 to 128 characters, with the entropy shown.

Mathematics & calculationFeaturedUse this tool

Generate one or more random UUID v4 identifiers instantly and copy them when needed.

Mathematics & calculationFeaturedUse this tool

Create brand, product, project or domain names from your keywords – not personal names.

Mathematics & calculationUse this tool