API & MCP
Everything a person can do on Random Generator, a program or AI agent can do with the same inputs and get the identical result.
HTTP API
POST https://randomgenerator.usefulweb.site/api/v1/calculate– run Random GeneratorGET https://randomgenerator.usefulweb.site/api/v1/tool– inputs, output schema, examples- OpenAPI 3.1: /openapi.json · /openapi.yaml
- Errors:
application/problem+json;422includes per-fielderrors.
Random Generator
Generates random whole or decimal numbers (optionally unique), dice rolls such as 3d6+2, coin flips, picks from a list, shuffles, balanced teams (by optional skill), random dates, strings and UUID v4/v7. Uses cryptographic randomness by default; with a seed the output is reproducible so others can verify a draw.
| Field | Type | Default | Description |
|---|---|---|---|
mode | select (integers, floats, dice, coins, pick, shuffle, teams, dates, strings, uuid4, uuid7) | "integers" | Generate |
count | integer | 10 | How many. Numbers, rolls, flips, picks, dates, strings or UUIDs. |
min | number | 1 | Minimum |
max | number | 100 | Maximum |
unique | boolean | false | No repeats (numbers and picks) |
decimals | integer | 2 | Decimal places |
dice | text | "3d6" | Dice notation. NdS±M, e.g. 2d20, 4d6+2, d100. |
items | list | — | List (one per line; "name, skill" for teams) |
teams | integer | 2 | Number of teams |
dateFrom | date | "2026-01-01" | Earliest date |
dateTo | date | "2026-12-31" | Latest date |
length | integer | 16 | String length |
charset | select (alnum, unambiguous, lower, upper, digits, hex, symbols) | "alnum" | Characters |
seed | text | — | Seed (optional, for reproducible results). Empty = cryptographic randomness, different every time. With a seed, the same settings always give the same result — never use seeded output for passwords or keys. |
uuidTime | datetime | — | UUID v7 timestamp (optional). Default: now (UTC). Set it together with a seed for reproducible v7 UUIDs. |
Example request
Lottery 6 of 49 (seeded)
curl -X POST https://randomgenerator.usefulweb.site/api/v1/calculate -H 'content-type: application/json' -d '{"mode":"integers","count":6,"min":1,"max":49,"unique":true,"seed":"draw-2026-10-18"}'
Every result contains
inputs (normalised, defaults applied), summary, result (validated against the published schema), units, assumptions, sources, warnings, computedAt and links.
MCP (Model Context Protocol)
- Streamable HTTP endpoint:
https://randomgenerator.usefulweb.site/mcp– protocol revisions 2026-07-28 (stateless) and 2025-11-25 / 2025-06-18 / 2025-03-26 (initialize handshake). - Tools:
random_generator - Local stdio connector:
node src/mcp-stdio.ts --tool=random-generator
{
"mcpServers": {
"random-generator": { "type": "http", "url": "https://randomgenerator.usefulweb.site/mcp" }
}
}