Catalog/workflow-weighted-pick

Workflow

Seeded weighted random pick API

Selects items from a weighted list using a deterministic seeded PRNG so the same seed reproduces the exact pick, while honouring weights across seeds. Answers 'Which item does this seed pick?', 'How do I weight a reproducible random choice?'.

Price$0.02per request
MethodPOST
Route/v1/workflow/weighted-pick
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
weightedrandompickseeddeterministicselectionsamplingworkflow
API URLhttps://x402.hexl.dev/v1/workflow/weighted-pick
Integration docs
Example request
{
  "items": [
    {
      "value": "a",
      "weight": 1
    },
    {
      "value": "b",
      "weight": 3
    }
  ],
  "seed": 123
}
Example response
{
  "pick": "b",
  "picks": [
    "b"
  ],
  "seedUsed": 123,
  "probabilities": [
    {
      "value": "a",
      "p": 0.25
    },
    {
      "value": "b",
      "p": 0.75
    }
  ],
  "interpretation": "Seed 123 deterministically selected 'b'."
}
Input schema
{
  "type": "object",
  "required": [
    "items",
    "seed"
  ],
  "properties": {
    "items": {
      "type": "array",
      "examples": [
        [
          {
            "value": "a",
            "weight": 1
          },
          {
            "value": "b",
            "weight": 3
          }
        ]
      ]
    },
    "seed": {
      "examples": [
        123
      ]
    },
    "count": {
      "type": "integer"
    }
  }
}
Output schema
{
  "type": "object",
  "additionalProperties": true
}