{"uid":"cap_hGUiZkWZtqLd5CVBNGScj","slug":"animica-random-pick-165a67a8","name":"Animica Random Pick","description":"Pick k of your items with or without replacement, optionally weighted by integer weights (raffles, lotteries, sortition, A/B splits). One verified randomness draw, cumulative-weight search over a rejection-sampled uniform value, up to 10000 items. The exact rule and the raw draw ride along so you can recompute the winners.","url":"https://animica.dev/x402/random/pick","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"k":{"type":"integer","description":"how many to pick, 1..1000 (default 1; alias count). Without replacement k <= items.length"},"items":{"type":"array","description":"candidates, 1..10000 entries (any JSON values)"},"replace":{"type":"boolean","description":"true = with replacement (an item can win twice); default false"},"weights":{"type":"array","description":"one non-negative INTEGER weight per item (floats rejected: the cumulative search must be recomputable exactly)"},"request_id":{"type":"string","description":"your own tag; mixed into the DRNG seed"},"indices_only":{"type":"boolean","description":"omit the picked items and return only their 0-based indices — use it when the items are large: the response cap is 4000000 bytes and with replace:true the same item can be emitted k times"}}},"responseSchema":{"type":"json"},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.001794","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.001794/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001794","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001794","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_frI8Ab2ElHFJVrABQNnlG","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.001794","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Randomly selects k items from a candidate list using verifiable DRNG-based randomness, with optional weighting and replacement","exampleAgentPrompt":"Pick 3 random winners from this list of contestants — ['Alice','Bob','Carol','Dave','Eve','Frank'] — without replacement and give me proof the draw was fair.","exampleUseCases":[{"title":"Raffle winner selection","prompt":"I have 500 raffle entries in this array — pick 5 winners without replacement and give me verifiable proof of the random draw so entrants can trust it."},{"title":"Weighted giveaway draw","prompt":"Run a weighted random pick from these prize tiers: ['Grand Prize','Second Prize','Third Prize','Consolation'] with weights [1,3,10,50] — pick 1 winner and show me the randomness attestation."},{"title":"Random A/B test assignment","prompt":"I need to randomly assign 10 user IDs from this list of 200 to a test group — pick 10 without replacement and return just their indices so I can map back to my dataset."}],"resultDescription":"Returns a JSON object containing: 'picked' (the selected items, omitted if indices_only=true), 'indices' (0-based positions of picks), 'k' (count picked), 'replace' flag, 'weighted' flag, 'randomness' (DRNG seed/output), 'source', 'health', 'attestation', 'verification', and 'derivation' (rules, steps, optional recompute instructions) — plus payment metadata for the x402 micropayment.","failureModes":["items array empty or exceeds 10000 entries — request rejected","k exceeds items.length when replace=false — invalid parameter error","weights array length does not match items array — rejected","float values in weights — rejected (integers only)","response body exceeds 4MB cap (especially with replace:true and large items) — use indices_only:true","Payment of 0.006731 USDC not provided or insufficient — 402 Payment Required"],"whenToPreferThis":"Choose this endpoint when you need cryptographically verifiable, auditable random selection — not just any pseudorandom pick. The DRNG-backed attestation and derivation steps make it suitable for public lotteries, giveaways, or any scenario where participants must be able to independently verify the fairness of the draw. Prefer it over a local random function when auditability, reproducibility via request_id, or weighted sampling is required.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-14T18:43:38.351Z","isFirstParty":false}