ForHosting KIT · Math

D20 dice roller

Seed 42 always lands on 17: the same seed always gives the same face of a fair twenty-sided die, so a game master, a player or a reviewer can check the roll later. Use it for attacks, saves and initiative. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Seed
42
You get
Result
17
Faces
20
Die
d20
Min
1

A d20 dice roller is the standard way tabletop players, game masters, and digital tools produce a single face from a twenty-sided die. The same seed always yields the same face.

What a seeded d20 roll actually returns

A twenty-sided die is a discrete uniform random variable on the integers one through twenty: each face is equally likely, and a single roll is one independent draw. A d20 dice roller therefore does not compute a probability mass or a range of possible totals; it materializes one concrete face so you can resolve an attack, a saving throw, an initiative check, or a classroom trial of a uniform distribution. Determinism is part of the product promise.

The mapping is fixed, the generator is fixed, and there is only one draw, so the seed is a complete description of the experiment. Fairness is hard-coded at twenty equally likely faces; this landing is not a custom-sided laboratory and it does not accept a bias parameter. When the seed is not a non-negative integer the task fails instead of inventing a face, because a fractional or negative seed is not a d20 result that anyone can grade.

What to enter and what you get back

Zero is a valid seed and is not treated as missing. A negative seed is rejected because the contract is a non-negative integer, not a signed nonce. Those failures are not billed.

On success the body echoes seed, returns result as an integer from 1 through 20, sets faces to 20 and die to d20, and repeats min 1 and max 20 so a renderer can label the primary value without a hard-coded legend. Example: seed forty-two always produces the same face, and seed zero always produces its own stable face. Failed validation does not consume balance.

Tabletop and virtual-tabletop sessions

Publish a session seed so every player and the game master recompute the same natural d20 for attacks, saves, and initiative without passing a physical die.

Auditable contest and exam rolls

Record the seed next to a raffle, kickoff, or exam item so any later reviewer can reconstruct the exact face from 1 to 20.

How do I roll a d20 with this tool?

Send seed as a non-negative integer. The same seed always produces the same face.

What happens if the seed is not a non-negative integer?

Missing values, negatives, fractions, empty strings, and values outside the safe integer range are rejected and are not billed.

Can I change the number of sides or bias the die?

No. This landing is a fair twenty-sided die only. Custom-sided ranges and sum probabilities belong to the sibling dice-notation and probability tools.

Why does a d20 dice roller need a seed?

The seed makes the face reproducible. Two machines, two graders, or a later audit reconstruct the same roll. Seed zero is valid and is not treated as missing.

Can I add modifiers or roll with advantage?

No. The tool returns only the natural d20, one face from 1 to 20. Modifiers, advantage and damage dice are handled on your own character sheet or at the table, using this face as the starting point.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/stat/d20-dice-roller

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/stat/d20-dice-roller \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"seed":42}'
{
  "seed": 42
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "stat.d20_dice_roller",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

A seed that is missing, negative, or not an integer fails with invalid_input instead of inventing a roll.

What a seeded d20 roll actually returns

This endpoint initializes a mulberry32 generator from the non-negative integer seed you send, takes one unsigned thirty-two-bit word, and maps that word onto the closed integer range from 1 to 20 inclusive with a remainder that never produces 0 or 21. The response echoes the seed, returns result as the integer face, and documents faces, die, min, and max so clients can display the roll without extra constants. Identical seeds always produce identical JSON because the path never consults the wall clock or the host random source.

Input contract, response shape, and error behaviour

POST a JSON body with seed set to a non-negative integer; aliases rng_seed and value are accepted when clients reuse older form names. Each field may arrive as a JSON number or as a numeric string of digits; empty strings, booleans, objects, fractions, and values outside the safe integer range fail with invalid_input naming the field. Pair the response with your own tabletop sheet if you need modifiers, advantage, or a damage die; this endpoint only rolls the natural d20. Keep seeds documented next to the session log, pin goldens for the seeds you ship, and treat invalid_input as a data-quality signal rather than retrying a malformed integer.

Where a seeded d20 dice roller earns its keep

Tabletop groups and virtual tabletops use a d20 dice roller so every player can see the same natural twenty or natural one that the published seed implies, without passing a physical icosahedron around the table or trusting a client that could have been edited. Contest organizers and charity raffles need an auditable toss: given the published seed, any later reviewer can recompute the exact face that decided a prize or a kickoff. Developers call the same contract from scripts to seed unit-test vectors, to drive Monte Carlo worksheets that must match a printed key, or to satisfy programming-challenge statements that demand a single d20 rather than a binomial probability. Exam-prep generators and probability classrooms need a deterministic oracle that marks a wrong seed as invalid_input instead of silently returning an empty face a buggy grader might treat as success. Keep requests to one seed per call, pin the integer result in tests, and you get reproducible twenty-sided faces for homework, LMS plugins, and edge workers without standing up a custom random service of your own.

Deterministic test fixtures

Generate a stable d20 face in unit tests and Monte Carlo worksheets so continuous integration and printed answer keys never drift between machines.

What does the d20 dice roller cost?

The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input is not billed.

Read the full KIT documentation →