# Random Number Generator

> Free random number generator with secure or reproducible seeded draws, six distributions, weights, dice notation and live statistics. 100% in your browser.

URL: https://acrafto.com/en/online-random-number-generator/  
Updated: 2026-08-28

Tools are interactive browser apps; there is no public API, no endpoints to call and no server-side processing. To use a tool, open its HTML page in a browser.

## How does the Random Number Generator work?

The generator gives you **two sources of randomness**, and you choose which one fits the job.

**Secure random** draws entropy from your operating system through the Web Crypto API (`crypto.getRandomValues()`). It is unpredictable and unrepeatable — the right choice for a real draw where nobody should be able to guess the outcome in advance.

**Seeded** turns any text you type into a starting state for a deterministic generator (xoshiro128\*\*). The same seed always produces the same numbers, so anyone can replay your draw and confirm you got what you say you got.

Both run **entirely in your browser**. No number ever reaches a server.

### No modulo bias

Most simple generators map a random 32-bit value onto your range with `value % range`. When the range does not divide evenly into 2³², the lowest numbers come up slightly more often than the rest. Over thousands of draws it is measurable.

This generator uses **rejection sampling** instead: values that would fall into the uneven tail are thrown away and redrawn. Every number in your range has exactly the same chance. You can verify it yourself with the built-in uniformity test.

## What the generator can do

### Range

- **Minimum and maximum** — any whole or decimal range, negative values included
- **How many numbers** — from 1 up to **1,000,000** in one draw
- **No repeats** — every number appears at most once, the way a real draw works
- **Sort** — draw order, ascending, or descending; sorting never touches the randomness
- **Step** — restrict results to multiples of a value, so only 0, 5, 10, 15 come up
- **Exclude numbers** — list values that must never be drawn

### Mode

- **Source of randomness** — secure (Web Crypto) or seeded (reproducible)
- **Seed** — any text; the same seed always replays the same draw
- **Distribution** — uniform, normal (Gaussian), exponential, Poisson, triangular, binomial
- **Weights** — give chosen numbers a higher chance, written as `number:weight`
- **Dice notation** — `3d6+2`, `d20`, `2d20kh1` for advantage, `4d6dl1` for rolling stats

### Output

- **Separator** — comma, space, semicolon, tab, new line, or anything you type
- **Number system** — decimal, binary, octal, hexadecimal, or base 36
- **Pad with zeros** — turn 7 into 007 for ticket or ID numbers
- **Prefix and suffix** — wrap every number in fixed text
- **Template** — `{n}` is the number, `{i}` its position, so `user{n}` becomes `user42`
- **Copy as** — plain text, CSV, JSON, or a Markdown table

### Statistics

Every draw is summarised live: sum, mean, median, lowest, highest, standard deviation, plus how many results are even, odd, or prime. A histogram shows the shape of the distribution, and a **chi-square test** tells you whether the results actually match a uniform distribution.

### History

The last 50 draws are kept in your browser, with the settings that produced them — one click restores any of them. Configurations you use often can be saved as named presets, and the whole lot exports to a JSON file you can import on another machine. Nothing is stored anywhere but this browser.

### Keyboard

Press **Space** or **R** to draw again without reaching for the mouse.

## Quick presets

| Preset | Range | Count | Usage |
| --- | --- | --- | --- |
| 🎲 Dice | 1–6 | 1 | Board games, deciding |
| 🪙 Coin | 0–1 | 1 | Heads or tails |
| 🎰 Lottery | 1–49 | 6 | Unique, sorted, like a real draw |
| 💯 1–100 | 1–100 | 1 | Percentages, A/B splits |
| 🔢 PIN | 0–9 | 4 | Four digits, repeats allowed |

## Reproducible draws

Seeded mode exists for the moments when “trust me, it was random” is not enough.

Pick a seed everyone can agree on in advance — a date, a hashtag, the closing price of something public — and announce it before you draw. Anyone can then type the same seed with the same settings and get the identical result. You have not proved the numbers were unpredictable; you have proved you did not reroll until you liked the answer.

It is also how you make randomness repeatable in work that has to be checked: a sampling plan a colleague can rerun, a set of test fixtures that stays stable across a test suite, a classroom exercise where every student gets the same “random” data.

## Choosing a distribution

**Uniform** gives every number in the range the same chance. It is what people usually mean by random, and it is the default.

The others cluster results around a value, which is what real-world quantities tend to do:

- **Normal (Gaussian)** — heights, measurement errors, test scores. Set a mean and a standard deviation.
- **Exponential** — waiting times between independent events.
- **Poisson** — counts of events in a fixed interval: arrivals per hour, defects per batch.
- **Triangular** — when you know the minimum, maximum, and most likely value but nothing else. Common in project estimates.
- **Binomial** — successes out of a fixed number of trials at a fixed probability.

Every distribution is clipped to the range you set, so a long Gaussian tail cannot escape your minimum and maximum.

## Where random numbers get used

### Games and entertainment

- **Board games** — dice rolls, turn order
- **Tabletop RPGs** — `4d6dl1` for ability scores, `2d20kh1` for advantage
- **Giveaways** — picking a winner, with a seed so entrants can verify it
- **Quizzes** — random question order

### Statistics and science

- **Sampling** — drawing a sample from a population without repeats
- **A/B testing** — assigning participants to groups
- **Monte Carlo simulation** — estimating probability by repetition
- **Bootstrapping** — resampling to estimate uncertainty

### Development

- **Test data** — a million values, generated in the background so the page stays responsive
- **Fixtures** — seeded, so a failing test fails the same way twice
- **Random IDs** — with padding, prefixes, or a template
- **Load testing** — templated identifiers like `user{n}@example.com`

## True vs. pseudorandom numbers

|  | `Math.random()` | `crypto.getRandomValues()` | Seeded (xoshiro128\*\*) |
| --- | --- | --- | --- |
| **Type** | Pseudorandom | Cryptographically secure | Pseudorandom, deterministic |
| **Entropy source** | Engine-chosen seed | System CSPRNG | Your seed text |
| **Predictable?** | Potentially | No | Yes, by design |
| **Repeatable?** | No | No | Always |
| **Good for security** | No | Yes | No |
| **Good for statistics** | Depends | Yes | Yes |
| **Good for verifiable draws** | No | No | Yes |

`Math.random()` is not used anywhere in this tool.

## Draws without repetition

With **No repeats** enabled, each number in the range appears at most once. Ideal for:

- **Giveaways** — nobody can win twice
- **Permutations** — shuffling a set of items
- **Bingo** — calling numbers that stay called
- **Lottery** — six distinct numbers from 1 to 49

The draw uses a partial Fisher–Yates shuffle, so asking for 6 numbers out of a million is as fast as asking for 6 out of 49 — it never loops hoping to avoid a collision. If you ask for more unique numbers than the range can supply, the generator says so instead of hanging.

## Exporting results

Copy the numbers as plain text with any separator you like, as **CSV** for a spreadsheet, as **JSON** for code, or as a **Markdown table** for documentation. Very large draws stay in memory in full and copy in full, even though only the first couple of thousand are drawn on screen.

## Generating random numbers in your own code

### JavaScript / TypeScript

```
// Cryptographically secure integer in [min, max], without modulo bias.
// The naive `value % range` favours low numbers when range does not
// divide 2**32 evenly - so we reject values in the uneven tail.
function randomInt(min, max) {
  const range = max - min + 1;
  const limit = Math.floor(0x100000000 / range) * range;
  const arr = new Uint32Array(1);
  let value;
  do {
    crypto.getRandomValues(arr);
    value = arr[0];
  } while (value >= limit);
  return min + (value % range);
}
```

### Python

```
import random
import secrets

# Cryptographically secure, no modulo bias
n = secrets.randbelow(max - min + 1) + min

# Reproducible: the same seed always gives the same sequence
rng = random.Random('my-seed')
n = rng.randint(min, max)

# Without repetition
sample = random.sample(range(min, max + 1), count)
```

### PHP

```
// Cryptographically secure (PHP 7+), no modulo bias
$n = random_int($min, $max);

// Reproducible
mt_srand(crc32('my-seed'));
$n = mt_rand($min, $max);
```

## Frequently asked questions (FAQ)

### Is the result truly random?

In secure mode, yes. It comes from `crypto.getRandomValues()`, a cryptographically secure generator fed by your operating system's entropy pool. Results are uniformly distributed and unpredictable. Seeded mode is deliberately the opposite: it is reproducible, which is the point.

### How many numbers can I generate at once?

Up to 1,000,000. Draws above 50,000 are calculated in a background worker so the page stays responsive, and the screen shows the first 2,000 with a count of the rest — copying still gives you everything.

### Can I generate negative numbers?

Yes. Set a negative minimum. The full range of JavaScript numbers works, including negative ranges on both ends.

### Does sorting affect randomness?

No. Numbers are drawn first and sorted afterwards. Sorting changes only the order you see them in.

### Will the same seed give the same numbers tomorrow?

Yes, and on any other device or browser. The seeded generator is fully deterministic and depends on nothing but your seed and settings.

### What does the uniformity test tell me?

It runs a chi-square test comparing how often each number actually came up against how often it should have. If the statistic stays below the critical value, the results are consistent with a uniform distribution. It needs a reasonably narrow range and enough draws — at least five per possible value — to say anything meaningful.

### How do weights work?

Write them as `number:weight` pairs, for example `1:5, 2:1, 3:1`. Here 1 is five times as likely as 2 or 3. Numbers you do not list get a weight of zero and are never drawn.

### What dice notation is supported?

`3d6` rolls three six-sided dice. Add a modifier with `3d6+2`. Keep or drop dice with `kh`, `kl`, `dh`, `dl` — so `2d20kh1` keeps the highest of two d20s (advantage) and `4d6dl1` drops the lowest of four d6s.

### Is my history stored anywhere?

Only in this browser, in local storage. It never reaches a server, never syncs to another device, and disappears if you clear your site data. Export it to JSON if you want to keep or move it.

## Other languages

- Čeština (cs): [Generátor náhodných čísel](https://acrafto.com/cs/generator-nahodnych-cisel/) ([Markdown](https://acrafto.com/cs/generator-nahodnych-cisel/index.md))
- Slovenčina (sk): [Generátor náhodných čísel](https://acrafto.com/sk/generator-nahodnych-cisel/) ([Markdown](https://acrafto.com/sk/generator-nahodnych-cisel/index.md))
- Deutsch (de): [Zufallszahlen Generator](https://acrafto.com/de/zufallszahlen-generator-online/) ([Markdown](https://acrafto.com/de/zufallszahlen-generator-online/index.md))
- Français (fr): [Générateur de nombres aléatoires](https://acrafto.com/fr/generateur-nombres-aleatoires/) ([Markdown](https://acrafto.com/fr/generateur-nombres-aleatoires/index.md))
- Español (es): [Generador de números aleatorios](https://acrafto.com/es/generador-numeros-aleatorios-online/) ([Markdown](https://acrafto.com/es/generador-numeros-aleatorios-online/index.md))
- Italiano (it): [Generatore di numeri casuali](https://acrafto.com/it/generatore-numeri-casuali/) ([Markdown](https://acrafto.com/it/generatore-numeri-casuali/index.md))
- Português (pt): [Gerador de números aleatórios](https://acrafto.com/pt/gerador-numeros-aleatorios/) ([Markdown](https://acrafto.com/pt/gerador-numeros-aleatorios/index.md))
- Nederlands (nl): [Random getal generator](https://acrafto.com/nl/generator-willekeurige-getallen/) ([Markdown](https://acrafto.com/nl/generator-willekeurige-getallen/index.md))
- Polski (pl): [Generator liczb losowych](https://acrafto.com/pl/generator-liczb-losowych-online/) ([Markdown](https://acrafto.com/pl/generator-liczb-losowych-online/index.md))
- Română (ro): [Generator numere aleatoare](https://acrafto.com/ro/generator-numere-aleatoare-online/) ([Markdown](https://acrafto.com/ro/generator-numere-aleatoare-online/index.md))
- Magyar (hu): [Véletlenszám generátor](https://acrafto.com/hu/veletlen-szam-generator/) ([Markdown](https://acrafto.com/hu/veletlen-szam-generator/index.md))
- Ελληνικά (el): [Γεννήτρια τυχαίων αριθμών](https://acrafto.com/el/generator-tychaion-arithmon-online/) ([Markdown](https://acrafto.com/el/generator-tychaion-arithmon-online/index.md))
- Български (bg): [Генератор на случайни числа](https://acrafto.com/bg/generator-sluchayni-chisla/) ([Markdown](https://acrafto.com/bg/generator-sluchayni-chisla/index.md))
- Hrvatski (hr): [Generator slučajnih brojeva](https://acrafto.com/hr/generator-nasumicnih-brojeva/) ([Markdown](https://acrafto.com/hr/generator-nasumicnih-brojeva/index.md))
- Slovenščina (sl): [Generator naključnih števil](https://acrafto.com/sl/generator-nakljucnih-stevil/) ([Markdown](https://acrafto.com/sl/generator-nakljucnih-stevil/index.md))
- Eesti (et): [Juhuslike arvude generaator](https://acrafto.com/et/juhuslike-arvude-generaator/) ([Markdown](https://acrafto.com/et/juhuslike-arvude-generaator/index.md))
- Latviešu (lv): [Gadījuma skaitļu ģenerators](https://acrafto.com/lv/gadijuma-skaitlu-generators/) ([Markdown](https://acrafto.com/lv/gadijuma-skaitlu-generators/index.md))
- Lietuvių (lt): [Atsitiktinių skaičių generatorius](https://acrafto.com/lt/atsitiktiniu-skaiciu-generatorius/) ([Markdown](https://acrafto.com/lt/atsitiktiniu-skaiciu-generatorius/index.md))
- Svenska (sv): [Slumptalsgenerator](https://acrafto.com/sv/slumptalsgenerator/) ([Markdown](https://acrafto.com/sv/slumptalsgenerator/index.md))
- Dansk (da): [Tilfældighedsgenerator](https://acrafto.com/da/tilfaeldighedsgenerator-online/) ([Markdown](https://acrafto.com/da/tilfaeldighedsgenerator-online/index.md))
- Suomi (fi): [Satunnaislukugeneraattori](https://acrafto.com/fi/satunnaislukugeneraattori/) ([Markdown](https://acrafto.com/fi/satunnaislukugeneraattori/index.md))
- Norsk (no): [Tilfeldig tallgenerator](https://acrafto.com/no/tilfeldig-tallgenerator/) ([Markdown](https://acrafto.com/no/tilfeldig-tallgenerator/index.md))
- Українська (uk): [Генератор випадкових чисел](https://acrafto.com/uk/generator-vypadkovyh-chysel/) ([Markdown](https://acrafto.com/uk/generator-vypadkovyh-chysel/index.md))
- Русский (ru): [Генератор случайных чисел](https://acrafto.com/ru/generator-sluchajnyh-chisel/) ([Markdown](https://acrafto.com/ru/generator-sluchajnyh-chisel/index.md))
- Српски (sr): [Generator nasumičnih brojeva](https://acrafto.com/sr/generator-nasumicnih-brojeva/) ([Markdown](https://acrafto.com/sr/generator-nasumicnih-brojeva/index.md))
- Македонски (mk): [Генератор на случајни броеви](https://acrafto.com/mk/generator-slucajni-broevi/) ([Markdown](https://acrafto.com/mk/generator-slucajni-broevi/index.md))
- Bosanski (bs): [Generator nasumičnih brojeva](https://acrafto.com/bs/generator-nasumicnih-brojeva/) ([Markdown](https://acrafto.com/bs/generator-nasumicnih-brojeva/index.md))
- Shqip (sq): [Gjenerator numrash të rastësishëm](https://acrafto.com/sq/gjenerator-numrash-rastesishem/) ([Markdown](https://acrafto.com/sq/gjenerator-numrash-rastesishem/index.md))
- Türkçe (tr): [Rastgele sayı üretici](https://acrafto.com/tr/rastgele-sayi-uretici/) ([Markdown](https://acrafto.com/tr/rastgele-sayi-uretici/index.md))
- 日本語 (ja): [乱数生成ツール](https://acrafto.com/ja/ransu-generator/) ([Markdown](https://acrafto.com/ja/ransu-generator/index.md))
- 한국어 (ko): [랜덤 숫자 생성기](https://acrafto.com/ko/random-number-generator/) ([Markdown](https://acrafto.com/ko/random-number-generator/index.md))
- العربية (ar): [مولد أرقام عشوائية](https://acrafto.com/ar/random-number-generator/) ([Markdown](https://acrafto.com/ar/random-number-generator/index.md))
- हिन्दी (hi): [रैंडम नंबर जनरेटर](https://acrafto.com/hi/random-number-generator/) ([Markdown](https://acrafto.com/hi/random-number-generator/index.md))
- Bahasa Indonesia (id): [Generator angka acak](https://acrafto.com/id/generator-angka-acak-online/) ([Markdown](https://acrafto.com/id/generator-angka-acak-online/index.md))
- Tiếng Việt (vi): [Tạo số ngẫu nhiên](https://acrafto.com/vi/cong-cu-tao-so-ngau-nhien/) ([Markdown](https://acrafto.com/vi/cong-cu-tao-so-ngau-nhien/index.md))
- ไทย (th): [สุ่มตัวเลข](https://acrafto.com/th/random-number-generator/) ([Markdown](https://acrafto.com/th/random-number-generator/index.md))
- עברית (he): [מחולל מספרים אקראיים](https://acrafto.com/he/random-number-generator/) ([Markdown](https://acrafto.com/he/random-number-generator/index.md))
