{"uid":"cap_lVEJ3baWbIxBe-tFnBTOh","slug":"animica-random-integer-generator-efca4ba0","name":"Animica Random Integer Generator","description":"Uniform integers in [min, max] derived from ONE verified randomness draw by rejection sampling (never modulo bias) — up to 1000 per request. The response carries the raw draw, the node's source/health/attestation and the exact rule, so you can recompute every integer offline.","url":"https://animica.dev/x402/random/int","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"max":{"type":"integer","description":"upper bound, inclusive (>= min)"},"min":{"type":"integer","description":"lower bound, inclusive"},"count":{"type":"integer","description":"how many integers, 1..1000 (default 1; alias n)"},"request_id":{"type":"string","description":"your own tag; mixed into the DRNG seed so you can recompute this exact draw"}}},"responseSchema":{"type":"json","example":{"bytes":32,"health":{"passed":true,"min_entropy_per_byte":7.8216},"result":{"max":6,"min":1,"ints":[5,1,2],"count":3},"source":{"name":"software-fallback","model":"os.urandom CSPRNG","notes":"non-attested fallback for testing/degraded mode","vendor":"os","attested":false,"is_quantum":false,"device_path":null,"is_hardware":false},"product":"random_int","encoding":"hex","derivation":{"kind":"range","rules":{"seed":"seed = sha3_256(\"animica/qrng/public/v1\" || \"|k:\" || kind || \"|r:\" || request_id || \"|b:\" || bytes(randomness))","stream":"stream = sha3_256(seed || be8(counter)) for counter = 0,1,2,… concatenated; consumed left to right, never reused","uniform_int":"randbelow(n): k = floor((bitlen(n)+7)/8)+1 bytes per attempt, read big-endian as x; limit = 2^(8k); accept when x < limit - (limit mod n); value = x mod n. Rejected attempts still consume their k bytes. n <= 1 consumes nothing and returns 0. This is rejection sampling — plain \"x mod n\" would bias small values."},"steps":["seed the DRNG with kind=\"range\" and your request_id over the raw randomness above","for i = 0..2: ints[i] = 1 + randbelow(6)"],"domain":"animica/qrng/public/v1","seed_hex":"5fb4cc0e8007c201060453ee9b7cacb38444d32d76d423c61e601117fadd3068","verifier":{"api":"AnimicaBeacon.drngSeed(entropy, kind, request_id) + AnimicaBeacon.QDRNG reproduce the stream; AnimicaBeacon.verifyResult(derivation.recompute) === true whenever `recompute` is present","file":"randomness/beacon_api/static/verify.js (Animica repo, gitlab.com/Animica) — zero-dependency, runs in Node and the browser","note":"verify.js calls the seed material `beacon` because it was written for beacon rounds. This product is NOT a beacon round: the seed material is the raw `randomness` bytes above, which the node signed (see `verification`)."},"algorithm":"uniform-int-rejection-sampling","recompute":{"kind":"range","output":[5,1,2],"params":{"hi":6,"lo":1,"count":3},"round_id":0,"beacon_hex":"8e8d85d9c03247ffdff7b3db1c917b7a0e97a569e8cf098071dd91cc9121ae55","request_id":""},"request_id":"","entropy_hex":"8e8d85d9c03247ffdff7b3db1c917b7a0e97a569e8cf098071dd91cc9121ae55","stream_bytes_consumed":6},"randomness":"8e8d85d9c03247ffdff7b3db1c917b7a0e97a569e8cf098071dd91cc9121ae55","attestation":{"alg":"ed25519","backend":"software","attested":false,"digest_hex":"14a2636cf09e18539ab6ed62de65af350c2f6014d269b74d127fc1604c7aa68a","signature_hex":"bee4d32ee31dd92b07f1eee3113ed722c3c96c5fae98c509bcca8f66a5ceaff3eb4a6cd41cd97fc32deebdeeab18b4affea467549dd4ef387ddbdae6d415e900","public_key_hex":"8a2228f4bde8f72964a7ff4aa759f24932ae1cccd9462ad94ca6e508d6b87a64"},"verification":{"rules":["attestation.digest_hex == sha3_256(bytes(randomness))","ed25519_verify(pubkey=attestation.public_key_hex, message=raw_bytes(attestation.digest_hex), signature=attestation.signature_hex)"],"method":"signed-digest-attestation","attested":false,"verifier":"randomness/beacon_api/static/verify.js in the animica repo (gitlab.com/Animica) — dependency-free Node module exporting sha3_256; pair with any ed25519 verifier","trust_model":"signed by the serving node, not client-recomputable: you trust the node's entropy source, then verify it signed exactly these bytes. Check health.passed and attestation.attested before relying on it."}}},"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_dgqbCWuPZacvdk4ExfiaO","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":"Generates one or more cryptographically verifiable random integers within a specified inclusive range using a decentralized randomness beacon (DRNG)","exampleAgentPrompt":"Give me 5 random integers between 1 and 100 using Animica's verifiable randomness — I want to be able to recompute the draw offline, so tag it with request ID 'draw-2024-abc'.","exampleUseCases":[{"title":"Provably fair lottery draw","prompt":"Pick 6 unique random integers between 1 and 49 for a lottery draw — I need the full attestation and derivation steps so participants can independently verify the result was fair."},{"title":"Random game loot roll","prompt":"Roll 3 random integers between 1 and 20 for a tabletop RPG encounter — tag it 'session-42-encounter-boss' so I can reproduce the exact roll if needed."},{"title":"Statistical random sampling","prompt":"Generate 50 random integers between 0 and 999 for a Monte Carlo simulation sample — I need the randomness source and hex draw included in the response."}],"resultDescription":"A JSON object containing: the array of generated random integers (ints), the raw hex randomness draw from the DRNG, the randomness source and health status, an attestation and verification field for authenticity checks, a derivation object with rules, steps, and a recompute guide for offline verification, and payment metadata confirming the x402 micropayment.","failureModes":["min > max — returns error because range is invalid","count outside 1–1000 — returns error for out-of-range count","payment failure — x402 payment not confirmed, request rejected","DRNG beacon unavailable — source health check fails, randomness cannot be fetched","malformed request body — missing required min or max fields returns validation error"],"whenToPreferThis":"Choose this endpoint when you need cryptographically verifiable random integers with a full audit trail for offline recomputation — ideal for provably fair games, lotteries, or any application where participants must be able to independently verify the randomness. Prefer over standard PRNGs or unverifiable APIs when transparency and reproducibility matter. The request_id seeding feature makes it suitable for deterministic replay scenarios.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-14T18:33:19.790Z","isFirstParty":false}