Number Generator Settings

No duplicates (unique numbers only)
Sort results in ascending order

Generation History

No history yet. Generate some numbers!

Roll the Dice

Click any die or button to roll. Supports D4, D6, D8, D10, D12, D20, D100.

Quick Roll Presets

Flip a Coin

Click to flip!

or press Space

0
Heads
0
Tails
0
Total Flips
0%
Heads %

Random Item Picker

Enter items one per line. The picker will randomly select from your list.

Quick List Templates

How Random Numbers Work

Basic Random Integer

JavaScript's Math.random() returns a float between 0 (inclusive) and 1 (exclusive). We scale it to any range.

Math.random() [0, 1)

Random Integer (min to max):
Math.floor(Math.random() ร— (max โˆ’ min + 1)) + min

Random Decimal

Random Decimal = Math.random() ร— (max โˆ’ min) + min
Rounded to N places: parseFloat(num.toFixed(N))

Unique Numbers (No Duplicates)

To generate unique numbers, we use a Fisher-Yates shuffle on a range array and take the first N elements.

1. Create array [min, min+1, ..., max]
2. Fisher-Yates Shuffle:
for i from n-1 downto 1:
j = random integer from 0 to i
swap array[i] and array[j]
3. Return first N elements

Coin Flip

result = Math.random() < 0.5 ? "Heads" : "Tails"
Probability: exactly 50% for each outcome

Dice Roll (D-N)

D-N roll = Math.floor(Math.random() ร— N) + 1
Range: always 1 to N (inclusive)

Is Math.random() Truly Random?

Math.random() is a pseudo-random number generator (PRNG) - it uses an algorithm (typically xorshift128+) seeded by the current time. For cryptographic purposes, use crypto.getRandomValues() instead.

// Cryptographically secure version:
const arr = new Uint32Array(1);
crypto.getRandomValues(arr);
const random = arr[0] / 0xFFFFFFFF;

Frequently Asked Questions

For everyday purposes: yes. The generator uses JavaScript's Math.random(), a high-quality pseudo-random number generator (PRNG) seeded by system entropy. Every number in the range has exactly equal probability. For cryptographic purposes (security tokens, keys), the tool uses window.crypto.getRandomValues() - which is cryptographically secure and sourced from hardware entropy. For games, decisions, lotteries, and simulations, PRNG is indistinguishable from true randomness.
Set the minimum to 1 and maximum to your lottery's top number (e.g., 49 for a 1โ€“49 lottery). Set quantity to the number of balls drawn (e.g., 6). Enable 'No duplicates' and 'Sort results.' Click Generate. Each result has equal probability - there is no strategy that improves your odds. All lottery number combinations have identical probability, so this generator produces just as valid a selection as any other method.
No duplicates means each generated number is unique - no number appears twice in the result set. This is like drawing numbered balls without replacement: once a number is drawn, it can't be drawn again. Technically, the tool generates the full range as an array and applies a Fisher-Yates shuffle, then takes the first N elements. This guarantees perfect uniform distribution with no repeats. Enable it for raffles, lotteries, random team selections, and any scenario where uniqueness matters.
Dice notation: Dn means an n-sided die. D6 = standard 6-sided die (board games). D20 = 20-sided die (Dungeons & Dragons attack rolls, skill checks, saving throws). D4 = 4-sided die (small damage in RPGs). D8 = 8-sided die (weapon damage). D10 = 10-sided die (percentile when paired). D12 = 12-sided die (heavy weapon damage). D100 = 100-sided die (percentile rolls, encounter tables). All generate truly uniform results - every face has an equal 1-in-N probability.
The gambler's fallacy is the mistaken belief that past random results affect future ones. Example: 'I've flipped 10 heads in a row - tails is due.' Wrong. Each coin flip is independent - the probability is always 50/50 regardless of history. The coin has no memory. Similarly, if you've rolled the number 6 multiple times in a row, the next roll of a fair die is still exactly 1/6 for any outcome. A random number generator produces each result independently with equal probability, always.
Use the List Picker tab. Paste all entrant names (one per line) or a comma-separated list into the field, click Pick, and a randomly selected winner appears. Alternatively: if entries are numbered, generate a random number between 1 and the total number of entries - that number identifies the winner. Both methods are statistically fair when the random source is unbiased. The List Picker uses the Fisher-Yates shuffle to randomly rearrange all entries before selecting.
PRNG (Pseudo-Random Number Generator): uses an algorithm seeded by system entropy (time, hardware noise). Fast, uniform, passes statistical randomness tests. Sufficient for games, simulations, lotteries, decisions. Math.random() is a PRNG. Cryptographically Secure PRNG (CSPRNG): additionally designed so that even knowing all past outputs, future outputs cannot be predicted. Required for security tokens, passwords, session IDs, encryption keys. window.crypto.getRandomValues() is a CSPRNG. For everyday use, the difference is irrelevant - both produce statistically identical-looking random numbers.
Yes - this generator is ideal for classroom use. Common uses: sampling random numbers for mean/median exercises, simulating dice rolls for probability demonstrations (law of large numbers), random group assignment, simple random sampling from numbered lists, Monte Carlo simulation demonstrations. The decimal mode allows generating random numbers between 0 and 1 for probability experiments. The no-duplicates mode provides simple random sampling without replacement - a fundamental statistical sampling technique.

Random Number Generator - How It Works and What Each Mode Is Best For

Random number generation is used everywhere from scientific simulations to game development, lottery draws to security tokens, classroom exercises to decision-making. The right mode depends on what you need - this generator covers the most common use cases with tools designed for each one.

Quick guide: Picking a winner from a group List Picker. Lottery ticket Range 1โ€“49, Count 6, No Duplicates, Sorted. Board game die D6 Dice Roller. RPG combat D20 Dice Roller. Coin toss decision Coin Flip. Statistical sampling Multiple numbers in range with no duplicates.

Use Cases - Which Mode to Use

Number Generator

  • Single random number: Giveaway winner by entry number, quick decision, temperature simulation
  • Multiple numbers, no duplicates: Lottery, raffle, random seating or team assignment
  • Multiple numbers with duplicates: Monte Carlo simulation, bootstrapping, random sampling with replacement
  • Decimal numbers: Probability experiments, simulation parameters, random coordinates
  • Large ranges: Unique ID generation, random file naming

Dice, Coins & Lists

  • D6: Standard board games, Monopoly, Yahtzee, Catan
  • D20: Dungeons & Dragons attack rolls, skill checks, saving throws
  • D4/D8/D10/D12: RPG damage rolls and ability checks
  • D100: Percentile rolls, random encounter tables
  • Coin flip: Binary decisions, tiebreakers, probability demonstrations
  • List picker: Random task assignment, restaurant selection, team pairing

PRNG vs True Random - What's Actually Happening

Most digital random number generators are pseudo-random (PRNG) - they use a deterministic algorithm seeded by unpredictable system data (current time in microseconds, mouse position, hardware noise). The result appears random and passes all statistical tests for randomness, but is technically reproducible if you know the seed.

For everyday uses - picking a winner, rolling dice, generating lottery numbers - PRNG is statistically perfect. Each number has exactly equal probability, and past results have no influence on future ones (they are independent). The gambler's fallacy (thinking a coin is "due" for heads after many tails) doesn't apply - each flip is always 50/50 regardless of history.

For security-critical applications (generating cryptographic keys, tokens, session IDs), this tool uses window.crypto.getRandomValues() - the browser's cryptographically secure random number generator, seeded from hardware entropy. This is the same source used by secure applications.

The Fisher-Yates Shuffle - How "No Duplicates" Works

When you generate multiple unique numbers, the tool uses the Fisher-Yates shuffle algorithm (also called the Knuth shuffle). The method:

  1. Create an array containing all integers in your range (e.g., 1 to 49)
  2. Starting from the last element, swap it with a randomly chosen element from the remaining unshuffled portion
  3. Move to the previous position and repeat until the first element
  4. Take the first N elements as your result

This produces a perfectly uniform shuffle - every possible ordering has equal probability, and no number can appear twice. It's the standard algorithm used in card shuffling software, lottery systems, and any application requiring truly fair random selection without replacement.

How this calculator works, and where the numbers come from

The Random Number Generator applies the standard formula for this calculation to the values you enter and updates the result as you type. The calculation itself happens in your browser, and the page explains the method so you can check any result by hand.

Please note: Results are provided for general information and are calculated from the values you enter.

Sources and further reading

Last reviewed: by the CalcQube Editorial Team. See our editorial policy for how we build and check calculators, or report an error.