Catalog/gen-sample

Generators

Seeded sample (no replacement) API

Draws n distinct items without replacement from an array using a seeded shuffle. The value-add: reproducible subsamples for test splits/raffles. Answers 'How do I pick n random items deterministically?', 'Give me a reproducible sample without replacement.'.

Price$0.01per request
MethodPOST
Route/v1/generate/sample
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
samplewithout-replacementdeterministicseedsubsetsamplingrafflegenerate
API URLhttps://x402.hexl.dev/v1/generate/sample
Integration docs
Example request
{
  "items": [
    "a",
    "b",
    "c",
    "d",
    "e"
  ],
  "n": 3,
  "seed": "abc"
}
Example response
{
  "sample": [
    "d",
    "b",
    "a"
  ],
  "n": 3,
  "fromTotal": 5,
  "seed": "abc",
  "deterministic": true,
  "interpretation": "3 distinct items drawn without replacement; reproducible from the seed."
}
Input schema
{
  "type": "object",
  "required": [
    "items",
    "n",
    "seed"
  ],
  "properties": {
    "items": {
      "type": "array",
      "examples": [
        [
          "a",
          "b",
          "c",
          "d",
          "e"
        ]
      ]
    },
    "n": {
      "type": "integer",
      "minimum": 1,
      "examples": [
        3
      ]
    },
    "seed": {
      "type": [
        "string",
        "number"
      ],
      "examples": [
        "abc"
      ]
    }
  }
}
Output schema
{
  "type": "object",
  "additionalProperties": true
}