Select one original index and item with probability weight divided by total weight
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.
7000 (raw units)
price
1
calls / 30d
1
unique payers
2026-09-13
updated
Provider
api.solgiery.com · discovered, not yet claimed by its owner
Payment (x402 accepts[])
[
{
"scheme": "exact",
"network": "eip155:8453",
"payTo": "0x12fe99C184192A0d4a3C507602ad4b03AA3A6fbb",
"asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"amount": "7000",
"maxTimeoutSeconds": 60
}
]Output schema
{
"bazaar": {
"info": {
"input": {
"body": {
"items": [
"a",
"b",
"c"
],
"weights": [
1,
2,
0
]
},
"bodyType": "json",
"method": "POST",
"type": "http"
},
"output": {
"example": {
"algorithm": "solgiery-random-v1",
"entropy": {
"hex": "8080808080808080",
"source": "os-csprng"
},
"result": {
"index": 1,
"item": "b"
}
},
"type": "json"
}
},
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"input": {
"additionalProperties": false,
"properties": {
"body": {
"additionalProperties": false,
"description": "Unknown or duplicate parameters and null parameter values are rejected. JSON body: at most 65536 bytes, depth 16, and 4096 bytes per item. Repeated sample items together must fit 65536 bytes.",
"properties": {
"items": {
"items": {},
"maxItems": 1000,
"minItems": 1,
"type": "array"
},
"weights": {
"items": {
"maximum": 1000000000,
"minimum": 0,
"type": "integer"
},
"maxItems": 1000,
"minItems": 1,
"type": "array"
}
},
"required": [
"items",
"weights"
],
"type": "object"
},
"bodyType": {
"enum": [
"json",
"form-data",
"text"
],
"type": "string"
},
"method": {
"enum": [
"POST"
],
"type": "string"
},
"type": {
"const": "http",
"type": "string"
}
},
"required": [
"type",
"method",
"bodyType",
"body"
],
"type": "object"
},
"output": {
"properties": {
"example": {
"additionalProperties": false,
"properties": {
"algorithm": {
"const": "solgiery-random-v1",
"type": "string"
},
"entropy": {
"additionalProperties": false,
"properties": {
"hex": {
"maxLength": 262144,
"pattern": "^([0-9a-f]{2})*$",
"type": "string"
},
"source": {
"const": "os-csprng",
"type": "string"
}
},
"required": [
"source",
"hex"
],
"type": "object"
},
"result": {
"additionalProperties": false,
"properties": {
"index": {
"maximum": 999,
"minimum": 0,
"type": "integer"
},
"item": {}
},
"required": [
"index",
"item"
],
"type": "object"
}
},
"required": [
"algorithm",
"result",
"entropy"
],
"type": "object"
},
"type": {
"type": "string"
}
},
"required": [
"type"
],
"type": "object"
}
},
"required": [
"input"
],
"type": "object"
}
}
}Use it
curl
curl "https://api.solgiery.com/v1/random/weighted" # -> 402 Payment Required, accepts[] lists how to pay # retry with a PAYMENT-SIGNATURE (or PAYMENT header) once paid
JavaScript
const res = await fetch("https://api.solgiery.com/v1/random/weighted");
if (res.status === 402) {
const { accepts } = await res.json();
// pay one of accepts[] via an x402 client, then retry with the payment header
}Python
import httpx
res = httpx.get("https://api.solgiery.com/v1/random/weighted")
if res.status_code == 402:
accepts = res.json()["accepts"]
# pay one of accepts[] via an x402 client, then retry with the payment headerMachine-readable
Everything on this page is also available as clean JSON at /resources/7674.json, and this resource appears in /discovery/resources and /discovery/search.