utilpeek: cryptographically strong random numbers, bytes, UUIDs, dice rolls, picks and shuffles
generate_randomutilpeek: Generate cryptographically strong random numbers, bytes, UUIDs, dice rolls, picks and shuffles. Returns values from the OS CSPRNG (Python secrets): integers (uniform, inclusive range), floats in [min, max), 1-1,024 random bytes (hex or base64), UUID v4, dice rolls such as 3d6 or 2d10+3 with the total, picks from a list or a shuffle. Input: optional kind, min and max, count, length and encoding, dice, items and unique; an empty body gives one integer 0-100. Parameters that do not fit the kind, count over 1,000 or more than 1,000 items are a 422 before any payment (not charged). Nothing is stored or logged. Generate secret keys locally. Typically under 0.1 s. Price: USD 0.001. Free: 10 utilpeek calls per IP per UTC day.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| max | No | int: highest value, inclusive (default 100). float: upper bound, exclusive (default 1); max must exceed min. | |
| min | No | int: lowest value, inclusive (default 0). float: lowest, inclusive (default 0). | |
| dice | No | dice: an expression such as 3d6, d20 or 2d10+3 (1-100 dice of 2-1000 sides, optional +/- modifier; default 1d6). | |
| kind | No | int (default), float, bytes, uuid (v4), dice, pick or shuffle. | int |
| count | No | How many values (1-1000, default 1): int, float, uuid, pick. | |
| items | No | pick / shuffle: a comma-separated list (at most 1,000 items of 200 characters; blanks are dropped). | |
| length | No | bytes: how many random bytes (1-1024, default 16). | |
| unique | No | pick: draw without replacement (count at most the number of items). | |
| encoding | No | bytes: hex (default) or base64. | hex |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| max | No | ||
| min | No | ||
| dice | No | ||
| kind | No | ||
| count | No | ||
| error | No | Only on an error result: an object {code, message}, or the reason string of an x402 PaymentRequired object. | |
| rolls | No | ||
| total | No | ||
| value | No | ||
| length | No | ||
| source | No | ||
| unique | No | ||
| values | No | ||
| encoding | No | ||
| modifier | No | ||
| item_count | No |