Cryptographically secure randomness
secure_randomGenerate unbiased, cryptographically secure random bytes or uniform integers from a CSPRNG, with rejection sampling, for callers needing unpredictable randomness they cannot generate themselves.
Instructions
Cryptographically secure random values from a CSPRNG: either random bytes (hex and base64url) or uniform integers in an inclusive range. Integers are rejection-sampled, so the distribution is uniform rather than modulo-biased. For randomness nobody else could have seen, generate it yourself — this is for callers that cannot. Costs $0.003 USDC per call on Base mainnet (eip155:8453), paid automatically from the wallet in EVM_PRIVATE_KEY.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| max | No | Inclusive upper bound for integer mode. Requires min. | |
| min | No | Inclusive lower bound for integer mode. Requires max. | |
| bytes | No | Number of random bytes, 1..1024. Default 32. Ignored when min/max are given. | |
| count | No | How many integers to draw, 1..1000. Default 1. |