# Verifiable Random Number Generator (HMAC-SHA256)

> Verifiable Random Number Generator (HMAC-SHA256) is a paid API for AI agents from x402.forgemesh.io, paid per call via x402, $0.002/call, status unknown (last checked 2026-09-15).

Generates a cryptographically verifiable random integer within a specified min-max range using HMAC-SHA256 over a client-supplied seed, with server seed revealed for independent verification.

## Facts

- Endpoint: POST https://x402.forgemesh.io/verifiable-random-generator
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/verifiable-random-number-generator-hmac-sha256-69eeb4d2
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_BmjteUgYeAEzjZ5LnjZ_e

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability verifiable-random-number-generator-hmac-sha256-69eeb4d2 -d '<json body>'
```

Example prompt: Pick a verifiable random winner number between 1 and 500 using my seed 'raffle-2024-finalists' so I can prove the draw was fair afterward.

## When to prefer this

Choose this endpoint when you need a random integer that must be independently verifiable and tamper-evident — such as raffles, contests, matchmaking, tie-breaking between agents, or any scenario where auditability matters. Prefer it over standard PRNGs when 'trust me, it was random' is insufficient and participants need cryptographic proof.

## Known failure modes

- Invalid min/max values (e.g. min >= max) returning a 400 error
- Missing or malformed client_seed causing rejection
- Payment failure via x402 protocol resulting in 402 response
- Server-side seed generation failure returning 500 error

## How this service works

Draws a random integer within any min-max range using HMAC-SHA256 over a client-supplied seed, revealing the server seed so the draw can be independently recomputed and verified afterward. For raffles, matchmaking, tie-breaking between competing agents, and any process where 'trust me, it was random' isn't good enough.

## Output

Returns a random integer within the specified min-max range, along with the server seed and HMAC-SHA256 proof used to produce it, enabling anyone to recompute and confirm the result was not manipulated.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "max": {
   "type": "string",
   "description": "default 100"
  },
  "min": {
   "type": "string",
   "description": "default 1"
  },
  "client_seed": {
   "type": "string",
   "description": "your seed for verifiability"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "proof": "HMAC-SHA256(server_seed, client_seed) first 4 bytes mod range — recompute to verify",
  "value": 4,
  "server_seed_revealed": "e3b1..."
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/verifiable-random-number-generator-hmac-sha256-69eeb4d2/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402.forgemesh.io](https://www.zero.xyz/host/x402.forgemesh.io/llms.txt)
