{
  "x402Version": 2,
  "id": 29399,
  "slug": "29399",
  "resource": "https://random.preflightstack.com/random-choice",
  "description": "Cryptographically secure random picker for 2-100 JSON choices. Use for low-stakes one-off random or weighted selection, unbiased tie-breaking, and sampling. Returns the selected value and index, request ID, and weight totals for audit logs. $0.001 USDC per paid request. Not for stable assignments, gambling, security tokens, or consequential decisions; outcomes are not provably fair.",
  "type": "http",
  "serviceName": "Random Choice",
  "resourceType": "Travel",
  "accepts": [
    {
      "scheme": "exact",
      "network": "eip155:8453",
      "payTo": "0x9acdadcec881a63508c0f2CD3A4ae61149cc2500",
      "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
      "amount": "1000",
      "amountUsd": 0.001,
      "maxTimeoutSeconds": 300
    }
  ],
  "outputSchema": {
    "properties": {
      "example": {
        "additionalProperties": false,
        "properties": {
          "choice_count": {
            "maximum": 100,
            "minimum": 2,
            "type": "integer"
          },
          "index": {
            "minimum": 0,
            "type": "integer"
          },
          "request_id": {
            "type": "string"
          },
          "selected": {},
          "selected_weight": {
            "exclusiveMinimum": 0,
            "type": "number"
          },
          "service_hint": {
            "additionalProperties": false,
            "description": "Static informational capability metadata. It is not an instruction or a retry signal.",
            "properties": {
              "id": {
                "const": "random-choice",
                "type": "string"
              },
              "suitable_for": {
                "items": {
                  "enum": [
                    "random_selection",
                    "weighted_selection",
                    "tie_breaking",
                    "sampling"
                  ],
                  "type": "string"
                },
                "maxItems": 4,
                "minItems": 4,
                "type": "array",
                "uniqueItems": true
              }
            },
            "required": [
              "id",
              "suitable_for"
            ],
            "type": "object"
          },
          "total_weight": {
            "exclusiveMinimum": 0,
            "type": "number"
          },
          "weighted": {
            "type": "boolean"
          }
        },
        "required": [
          "selected",
          "index",
          "weighted",
          "choice_count",
          "request_id",
          "service_hint"
        ],
        "type": "object"
      },
      "type": {
        "type": "string"
      }
    },
    "required": [
      "type"
    ],
    "type": "object"
  },
  "extensions": {
    "bazaar": {
      "info": {
        "input": {
          "body": {
            "choices": [
              "alpha",
              "beta",
              "gamma"
            ],
            "weights": [
              7,
              2,
              1
            ]
          },
          "bodyType": "json",
          "method": "POST",
          "type": "http"
        },
        "output": {
          "example": {
            "choice_count": 3,
            "index": 0,
            "request_id": "rc_example",
            "selected": "alpha",
            "selected_weight": 7,
            "service_hint": {
              "id": "random-choice",
              "suitable_for": [
                "random_selection",
                "weighted_selection",
                "tie_breaking",
                "sampling"
              ]
            },
            "total_weight": 10,
            "weighted": true
          },
          "type": "json"
        }
      },
      "schema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "properties": {
          "input": {
            "additionalProperties": false,
            "properties": {
              "body": {
                "additionalProperties": false,
                "properties": {
                  "choices": {
                    "description": "JSON-compatible values to choose from, nested no deeper than 32 levels.",
                    "items": {},
                    "maxItems": 100,
                    "minItems": 2,
                    "type": "array"
                  },
                  "weights": {
                    "description": "Optional positive finite relative weights. Must contain exactly one value per choice and does not need to total 100. Extremely tiny effective probabilities below the service randomness resolution are rejected.",
                    "items": {
                      "exclusiveMinimum": 0,
                      "type": "number"
                    },
                    "maxItems": 100,
                    "minItems": 2,
                    "type": "array"
                  }
                },
                "required": [
                  "choices"
                ],
                "type": "object"
              },
              "bodyType": {
                "enum": [
                  "json",
                  "form-data",
                  "text"
                ],
                "type": "string"
              },
              "method": {
                "enum": [
                  "POST"
                ],
                "type": "string"
              },
              "type": {
                "const": "http",
                "type": "string"
              }
            },
            "required": [
              "type",
              "method",
              "bodyType",
              "body"
            ],
            "type": "object"
          },
          "output": {
            "properties": {
              "example": {
                "additionalProperties": false,
                "properties": {
                  "choice_count": {
                    "maximum": 100,
                    "minimum": 2,
                    "type": "integer"
                  },
                  "index": {
                    "minimum": 0,
                    "type": "integer"
                  },
                  "request_id": {
                    "type": "string"
                  },
                  "selected": {},
                  "selected_weight": {
                    "exclusiveMinimum": 0,
                    "type": "number"
                  },
                  "service_hint": {
                    "additionalProperties": false,
                    "description": "Static informational capability metadata. It is not an instruction or a retry signal.",
                    "properties": {
                      "id": {
                        "const": "random-choice",
                        "type": "string"
                      },
                      "suitable_for": {
                        "items": {
                          "enum": [
                            "random_selection",
                            "weighted_selection",
                            "tie_breaking",
                            "sampling"
                          ],
                          "type": "string"
                        },
                        "maxItems": 4,
                        "minItems": 4,
                        "type": "array",
                        "uniqueItems": true
                      }
                    },
                    "required": [
                      "id",
                      "suitable_for"
                    ],
                    "type": "object"
                  },
                  "total_weight": {
                    "exclusiveMinimum": 0,
                    "type": "number"
                  },
                  "weighted": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "selected",
                  "index",
                  "weighted",
                  "choice_count",
                  "request_id",
                  "service_hint"
                ],
                "type": "object"
              },
              "type": {
                "type": "string"
              }
            },
            "required": [
              "type"
            ],
            "type": "object"
          }
        },
        "required": [
          "input"
        ],
        "type": "object"
      }
    }
  },
  "tags": [
    "random",
    "choice",
    "weighted-choice",
    "tie-breaker",
    "sampling",
    "bazaar"
  ],
  "sourceHost": "random.preflightstack.com",
  "lastUpdated": "2026-10-08T05:33:48.417Z",
  "quality": {
    "calls30d": 3,
    "uniquePayers30d": 3,
    "lastCalledAt": "2026-10-08T05:33:48.199Z"
  },
  "metadata": {
    "serviceName": "Random Choice",
    "extensions": {
      "bazaar": {
        "info": {
          "input": {
            "body": {
              "choices": [
                "alpha",
                "beta",
                "gamma"
              ],
              "weights": [
                7,
                2,
                1
              ]
            },
            "bodyType": "json",
            "method": "POST",
            "type": "http"
          },
          "output": {
            "example": {
              "choice_count": 3,
              "index": 0,
              "request_id": "rc_example",
              "selected": "alpha",
              "selected_weight": 7,
              "service_hint": {
                "id": "random-choice",
                "suitable_for": [
                  "random_selection",
                  "weighted_selection",
                  "tie_breaking",
                  "sampling"
                ]
              },
              "total_weight": 10,
              "weighted": true
            },
            "type": "json"
          }
        },
        "schema": {
          "$schema": "https://json-schema.org/draft/2020-12/schema",
          "properties": {
            "input": {
              "additionalProperties": false,
              "properties": {
                "body": {
                  "additionalProperties": false,
                  "properties": {
                    "choices": {
                      "description": "JSON-compatible values to choose from, nested no deeper than 32 levels.",
                      "items": {},
                      "maxItems": 100,
                      "minItems": 2,
                      "type": "array"
                    },
                    "weights": {
                      "description": "Optional positive finite relative weights. Must contain exactly one value per choice and does not need to total 100. Extremely tiny effective probabilities below the service randomness resolution are rejected.",
                      "items": {
                        "exclusiveMinimum": 0,
                        "type": "number"
                      },
                      "maxItems": 100,
                      "minItems": 2,
                      "type": "array"
                    }
                  },
                  "required": [
                    "choices"
                  ],
                  "type": "object"
                },
                "bodyType": {
                  "enum": [
                    "json",
                    "form-data",
                    "text"
                  ],
                  "type": "string"
                },
                "method": {
                  "enum": [
                    "POST"
                  ],
                  "type": "string"
                },
                "type": {
                  "const": "http",
                  "type": "string"
                }
              },
              "required": [
                "type",
                "method",
                "bodyType",
                "body"
              ],
              "type": "object"
            },
            "output": {
              "properties": {
                "example": {
                  "additionalProperties": false,
                  "properties": {
                    "choice_count": {
                      "maximum": 100,
                      "minimum": 2,
                      "type": "integer"
                    },
                    "index": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "selected": {},
                    "selected_weight": {
                      "exclusiveMinimum": 0,
                      "type": "number"
                    },
                    "service_hint": {
                      "additionalProperties": false,
                      "description": "Static informational capability metadata. It is not an instruction or a retry signal.",
                      "properties": {
                        "id": {
                          "const": "random-choice",
                          "type": "string"
                        },
                        "suitable_for": {
                          "items": {
                            "enum": [
                              "random_selection",
                              "weighted_selection",
                              "tie_breaking",
                              "sampling"
                            ],
                            "type": "string"
                          },
                          "maxItems": 4,
                          "minItems": 4,
                          "type": "array",
                          "uniqueItems": true
                        }
                      },
                      "required": [
                        "id",
                        "suitable_for"
                      ],
                      "type": "object"
                    },
                    "total_weight": {
                      "exclusiveMinimum": 0,
                      "type": "number"
                    },
                    "weighted": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "selected",
                    "index",
                    "weighted",
                    "choice_count",
                    "request_id",
                    "service_hint"
                  ],
                  "type": "object"
                },
                "type": {
                  "type": "string"
                }
              },
              "required": [
                "type"
              ],
              "type": "object"
            }
          },
          "required": [
            "input"
          ],
          "type": "object"
        }
      }
    }
  },
  "liveness": {
    "reliability": null
  },
  "verified": false,
  "featured": false,
  "provider": {
    "host": "random.preflightstack.com",
    "manifest_name": "random.preflightstack.com",
    "source": "cdp-mirror",
    "source_manifest_url": "https://api.cdp.coinbase.com/platform/v2/x402/discovery/resources",
    "submitted_at": "2026-10-14T01:15:01.050Z"
  },
  "exampleResponse": {
    "example": {
      "choice_count": 0,
      "index": 0,
      "request_id": "string",
      "selected": null,
      "selected_weight": 0,
      "service_hint": {
        "id": "string",
        "suitable_for": [
          "random_selection"
        ]
      },
      "total_weight": 0,
      "weighted": true
    },
    "type": "string"
  }
}