{"uid":"cap_veBd4jupO3wTKabGg-b-N","slug":"weighted-random-item-selector-5bbb639f","name":"Weighted Random Item Selector","description":"Select a random item from weighted options (max 1000 items)","url":"https://rng.sociologic.ai/weighted?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","required":["value","weight"],"properties":{"value":{"description":"The item value"},"weight":{"type":"number","description":"Weight (positive number)"}}},"maxItems":1000,"description":"Array of weighted items"}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.02","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.02/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_ei9deJe8yMmAZrVWSroqL","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.02","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Selects a single random item from a list of up to 1000 weighted options using cryptographically secure randomness","exampleAgentPrompt":"Pick a random prize for me using these weighted options: 'Grand Prize' with weight 1, 'Second Prize' with weight 5, 'Consolation Prize' with weight 20, and 'No Prize' with weight 74.","exampleUseCases":[{"title":"Weighted loot drop in a game","prompt":"I need to randomly pick a loot item for a player: 'Legendary Sword' has weight 1, 'Rare Shield' has weight 10, 'Common Potion' has weight 50, and 'Nothing' has weight 39 — pick one for me."},{"title":"Random ad creative rotation","prompt":"I want to randomly select an ad variant to show a user — 'Video Ad' has weight 20, 'Banner Ad' has weight 50, and 'Text Ad' has weight 30. Pick one based on those weights."},{"title":"Probabilistic task assignment","prompt":"Assign this incoming support ticket to one of my agents: 'Alice' with weight 3, 'Bob' with weight 2, and 'Carol' with weight 5, where higher weight means more capacity right now."}],"resultDescription":"Returns the randomly selected item value from the weighted list, chosen with probability proportional to each item's weight relative to the total sum of all weights. The result is a single value drawn from the provided items array using cryptographically secure randomness.","failureModes":["Array exceeds 1000 items — returns 400 error","Weight values are zero or negative — invalid input","Items array is empty — returns error with no selection","Malformed item objects missing required value or weight fields — validation error","Payment not provided or insufficient — returns 402 Payment Required"],"whenToPreferThis":"Choose this endpoint when you need non-uniform random selection where different options should have different probabilities of being chosen. Prefer it over a simple shuffle or uniform random pick when outcomes have known likelihoods, rarity tiers, or priority scores. It is ideal for loot tables, A/B test traffic splitting, raffle draws, probabilistic routing, and simulation tasks where outcome frequency must match specified weights.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-01T12:38:39.424Z","isFirstParty":false,"canonicalSlug":"weighted-random-item-selector-5bbb639f"}