Returns JSON with cryptographically secure random values: integers in a range, dice rolls, coin flips, UUIDs or hex bytes, from the Workers Web Crypto CSPRNG.
Use this when you need a random number generator, dice rolls, a coin flip, a uuid or random bytes that no one can predict.
Do not use for verifiable on-chain randomness (VRF) or reproducible seeded sequences.
Price: 0.005 USDC per call (x402, eip155:8453). Typical response time: 500 ms (p95).
POST https://x402-gateway.blackwoodstate8.workers.dev/v1/random. A request without payment gets 402 Payment Required with the
PAYMENT-REQUIRED header; any x402 client signs an EIP-3009 authorization and retries with
PAYMENT-SIGNATURE (or X-PAYMENT). Invalid input is answered with 400 and not charged.
curl -i -X POST https://x402-gateway.blackwoodstate8.workers.dev/v1/random -H 'content-type: application/json' -d '{"kind":"dice","count":2,"sides":6}'
| Pay to | 0x60DdC7528FBEe16279C3ae7aC3647989CD714A11 |
|---|---|
| Asset | 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 (USDC) |
| Amount | 5000 atomic units (0.005 USDC) |
| Authorization window | 60 s |
Streamable HTTP at https://x402-gateway.blackwoodstate8.workers.dev/mcp, tool blackwood_random_generate. Payment goes in
_meta["x402/payment"]; without it the tool returns the payment requirements.
| Field | Type | Meaning |
|---|---|---|
kind | string | integer (count values between min and max), dice (count rolls of a die with sides faces), coin (count flips), uuid (count UUID v4) or bytes (length random bytes as hex) |
count (optional) | integer | How many values (1-100, default 1); ignored for bytes |
min (optional) | integer | integer: lowest value, inclusive (default 1) |
max (optional) | integer | integer: highest value, inclusive (default 100) |
sides (optional) | integer | dice: faces of the die (default 6) |
length (optional) | integer | bytes: how many random bytes (1-256, default 32) |
Example:
{
"kind": "dice",
"count": 2,
"sides": 6
}
Real example:
{
"kind": "dice",
"values": [
4,
1
],
"sum": 5,
"generatedAt": "2026-10-17T16:48:06.750Z",
"source": "crypto.getRandomValues (Cloudflare Workers CSPRNG)"
}
{
"type": "object",
"properties": {
"kind": {
"type": "string"
},
"values": {
"type": "array",
"items": {
"type": [
"number",
"string"
]
}
},
"sum": {
"type": [
"number",
"null"
]
},
"generatedAt": {
"type": "string"
},
"source": {
"type": "string"
}
},
"required": [
"kind",
"values",
"sum",
"generatedAt",
"source"
],
"additionalProperties": false
}Free schema and example: GET https://x402-gateway.blackwoodstate8.workers.dev/v1/random.
OpenAPI 3.1 · llms.txt · All services