Random Number Generator

Generate a single random integer, or a whole list of integers or decimals between any two limits. Uses your browser's cryptographic random source when available.

Simple Random Integer

Comprehensive Generator

Number type

What is a random number?

A random number is a value drawn from some range where every possible outcome has a known chance of appearing and there is no way to predict the next value from the previous ones. Rolling a fair six-sided die is the classic example — each face has a one-in-six chance and knowing the last roll tells you nothing about the next.

Random number generator, piece by piece

Each card explains one control on the generator above — how the range is mapped, how the "no repeats" option works, and why the histogram flattens out as you draw more samples.

Range mapping — from [0, 1) to your min/max

Every draw starts as a real number u in [0, 1) from the browser's generator. The calculator scales that into your chosen range: integers use floor(u·(max−min+1))+min so every whole value has an equal chance, and decimals use u·(max−min)+min rounded to the precision you pick.

integer: ⌊u·(max−min+1)⌋ + min  |  decimal: u·(max−min)+min
uuniform sample in [0, 1)·min, maxrange you entered
01u = 0.471100→ 48
Example
Given
min = 1
max = 100
u = 0.47
Substitute
⌊0.47·100⌋+1
Answer
48

No repeats — how the unique option works

When you tick "unique values" the calculator switches from independent draws to a shuffled sample. It builds the list of every integer in the range and does a Fisher–Yates shuffle, then takes the first n items — so you get n distinct values with no rejection loop, and asking for more values than the range holds is caught up front.

sample without replacement from [min
max]
ncount of values to draw·[min, max]candidate pool
371952846shuffled 1–9, no repeatsFisher–Yates on the range
Example
Given
range 1–9
count = 9
Substitute
shuffle then slice
Answer
3 7 1 9 5 2 8 4 6

Distribution histogram — why the bars level out

The histogram under the results counts how many draws landed in each bucket. Because every outcome is equally likely, the expected height in each bin is the same; small runs look uneven, but as n grows the bars even out toward count / bins. Big spikes on a large run signal a configuration mistake, not a broken generator.

expected count per bin = n / k
ntotal draws·knumber of bins
bins even out as n → ∞
Example
Given
n = 1000
k = 10
Substitute
1000 / 10
Answer
≈ 100 per bin

Worked example — mapping a uniform draw to a range

Pick a random integer between 1 and 100

Given
min = 1, max = 100, and the browser returns u = 0.47
Formula
x = ⌊u · (max − min + 1)⌋ + min
uuniform sample in [0, 1)·min, maxinclusive range you entered·xfinal random integer
Substitute
x = ⌊0.47 · (100 − 1 + 1)⌋ + 1
= ⌊47⌋ + 1
Answer
x = 48
Every one of the 100 integers has probability 1/100, because the floor step gives each a slice of [0, 1) of equal width 0.01.

Features of this calculator

  • Custom minimum and maximum range
  • Integer or decimal mode with configurable precision
  • Generate a single value or a batch in one click
  • Optional 'no duplicates' mode for lotteries and picks
  • One-tap regenerate with the same settings

Frequently asked questions

+Is Math.random truly random?

No — it is a pseudo-random generator. The output is deterministic given the seed but unpredictable in practice for non-security uses.

+Can I get repeatable results?

Not with this tool. It uses fresh entropy on every draw. For reproducibility you need a seedable PRNG in code.

+Why not use this for passwords?

Statistical randomness ≠ cryptographic randomness. Use a library like crypto.getRandomValues directly, or a dedicated password generator.

Related calculators