# Weighted Random Choice Selector

> Weighted Random Choice Selector is a paid API for AI agents from x402-zoo.lolagent.workers.dev, paid per call via x402, $0.001/call, status unknown (last checked 2026-09-14).

Randomly selects one item from a caller-supplied list using provided probability weights, useful for routing, games, and simulations.

## Facts

- Endpoint: GET https://x402-zoo.lolagent.workers.dev/api/weighted-choice
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/weighted-random-choice-selector-89e06a8d
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_0-kXdDVZoTt-GqefRpAwQ

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 weighted-random-choice-selector-89e06a8d
```

Example prompt: Pick one option from [red, blue, green] using weights [0.5, 0.3, 0.2] — red should be chosen half the time, blue 30%, and green 20%.

## When to prefer this

Use this endpoint when you need a lightweight, stateless, pay-per-call weighted random selection without maintaining local randomization logic. Ideal for routing decisions, game mechanics, simulation steps, or any scenario where options have unequal probabilities and you want a remote, reproducible API call rather than client-side RNG.

## Known failure modes

- Mismatched lengths between items and weights arrays returns an error
- Weights that don't sum to a valid distribution may cause undefined behavior
- Malformed query parameters (non-numeric weights, empty items list) return a 4xx error
- Network timeout or Cloudflare Worker cold start on rare occasions

## How this service works

Choose among options using caller-supplied probability weights for routing, games and simulations.

## Output

Returns the single selected item from the provided list, chosen according to the caller-supplied probability weights. The selection is non-deterministic across calls but statistically conforms to the given weights over many calls.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "items",
      "weights"
     ],
     "properties": {
      "items": {
       "type": "string"
      },
      "weights": {
       "type": "string"
      }
     }
    }
   },
   "additionalProperties": false
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/weighted-random-choice-selector-89e06a8d/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402-zoo.lolagent.workers.dev](https://www.zero.xyz/host/x402-zoo.lolagent.workers.dev/llms.txt)
