{"uid":"cap_fav2OuFNPIFaIOEaoG_GE","slug":"solgiery-random-weighted-selection-9dd24d51","name":"Solgiery Random Weighted Selection","description":"Select one original index and item with probability weight divided by total weight. Weights must match items and be integers from 0 to 1000000000; at least one must be positive. Uses the server OS CSPRNG. Returns consumed bytes for reproducible calculation, not proof of their origin. Price: 0.007 USDC per request, including the bounded batch.","url":"https://api.solgiery.com/v1/random/weighted","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"items":{"type":"array","items":{},"maxItems":1000,"minItems":1},"weights":{"type":"array","items":{"type":"integer","maximum":1000000000,"minimum":0},"maxItems":1000,"minItems":1}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.007","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.007/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.007","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.007","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_6yya_RPLfMDjwEdob5Mx4","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.007","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Selects one item from an array using cryptographically secure weighted random selection, returning the chosen item and its original index.","exampleAgentPrompt":"Pick one prize from my loot table using these weighted odds: ['common sword', 'rare shield', 'epic bow', 'legendary armor'] with weights [700, 200, 80, 20] — use cryptographically secure weighted random selection.","exampleUseCases":[{"title":"Weighted loot drop for game","prompt":"I have a game loot table with items ['gold coin', 'health potion', 'rare gem', 'legendary sword'] and weights [600, 300, 90, 10]. Pick one item for the player using proper weighted randomness."},{"title":"Proportional ad campaign selection","prompt":"I need to randomly pick one ad campaign to display, where 'Campaign A' gets 50% of impressions, 'Campaign B' gets 30%, and 'Campaign C' gets 20%. Use weights [500, 300, 200] to select one."},{"title":"Raffle winner with unequal tickets","prompt":"We have a raffle with participants ['Alice', 'Bob', 'Carol', 'Dave'] who bought [10, 3, 5, 2] tickets respectively — pick a winner randomly, proportional to their ticket count."}],"resultDescription":"Returns the selected item, its original array index, and the number of CSPRNG bytes consumed during the operation. The bytes count enables reproducible cost calculation but does not prove the origin of the randomness. The selection is performed using the server OS CSPRNG, giving cryptographically secure weighted probability.","failureModes":["Items and weights arrays of different lengths — request rejected","All weights are zero — at least one must be positive","Weight value out of range (negative or above 1,000,000,000) — validation error","Items array empty or exceeds 1,000 elements — rejected","Payment not settled (x402) — 402 response before computation","Network timeout — no result returned"],"whenToPreferThis":"Use this endpoint when you need a single cryptographically secure weighted random selection from a list where different items should have different probabilities. Prefer it over uniform random choice when items have unequal probability mass (e.g. loot tables, weighted lotteries, A/B traffic splitting, raffle draws proportional to ticket count). The CSPRNG backing makes it suitable for fairness-critical applications. For uniform (equal-weight) selection, use the sibling uniform select endpoint instead.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-14T06:41:26.876Z","isFirstParty":false}