๐ Overview
The Random Generator API provides cryptographically secure random number generation, dice rolls, coin flips and card draws. Perfect for games, simulations and decision-making applications.
๐ฒ Multiple Generator Types
Numbers, dice, coins, cards, and an all-in-one bundle
๐ Cryptographically Secure
Uses secure random number generation for true randomness
๐ Multiple Results
Batch dice rolls and coin flips (up to 10 per request) or draw up to a full deck of cards
๐ฏ Customizable Ranges
Full control over min/max values and constraints
๐ Base URL
๐ Authentication
No authentication required. This is a public API that can be accessed without any API keys or tokens.
๐ก API Endpoints
GET / POST /?type=... Random Generator
All five randomizer types are served from the same URL. Pick a value for type and supply any extra parameters as either query-string (GET) or JSON-body (POST) fields. Both work the same way.
Type Values
| Type | What it does | Extra params |
|---|---|---|
number |
One integer in [min, max] |
min (1), max (100) |
dice |
Roll count dice with sides faces |
sides (6, 2โ100), count (1, 1โ10) |
coin |
Flip count coins |
count (1, 1โ10) |
card |
Draw count random cards |
count (1, 1โ52 or 1โ54 with jokers), with_jokers (false) |
all |
Bundle of one number, one dice roll, one coin flip and one card draw | โ |
Example Request โ Number
Example Request โ Dice
Example Request โ Coin
Example Request โ Card
Example Request โ All
๐ Response Format
Number Response
Dice Response
When count=1 the result is a single integer instead of an array.
Coin Response
When count=1 the result is a single string ("Heads" or "Tails").
Card Response
When count=1 the result is a single card object. With with_jokers=true the deck has 54 cards (52 + 2 jokers).
All Response
Error Response
The API returns HTTP 400 with a free-form error string and the same api_info block.
Other triggers and their messages:
| Trigger | HTTP | error text |
|---|---|---|
type set to an unsupported value |
400 | Invalid type. Supported types: number, dice, coin, card, all (omitting type is not an error โ it defaults to number) |
min > max |
400 | Minimum value cannot be greater than maximum value |
dice sides outside 2โ100 |
400 | Dice sides must be between 2 and 100 |
dice count outside 1โ10 |
400 | Dice count must be between 1 and 10 |
coin count outside 1โ10 |
400 | Coin count must be between 1 and 10 |
card count outside 1โ52 (or 1โ54 with jokers) |
400 | Card count must be between 1 and 52 (or 1 and 54) |
| Any other unexpected failure | 500 | Internal server error |
๐ฏ Generator Types
๐ข Number Generator
Single integer between min and max (inclusive). Defaults: min=1, max=100.
๐ฒ Dice Roller
Roll count dice (1โ10) with sides faces (2โ100). Defaults: sides=6, count=1.
๐ช Coin Flip
Flip count coins (1โ10). Returns the per-flip result and a heads/tails tally. Default count=1.
๐ Card Draw
Draw count cards from a 52-card deck, optionally extended to 54 with with_jokers=true. Each card carries rank, suit, symbol, display, short and color.
๐ All-in-One
Returns one number (1โ100), one dice roll (6-sided), one coin flip and one card draw in a single response.
๐ก Use Cases
๐ฎ Game Development
Dice rolls, card draws, and random events for board games, RPGs, and video games.
๐ Statistical Sampling
Random numbers for surveys, A/B testing, and statistical simulation.
๐ Giveaways & Contests
Use the cryptographically secure random values as the randomness source in your own raffle and contest logic.
๐ Security & Tokens
Generate secure random tokens, nonces, and identifiers for authentication systems.
๐ฒ Decision Making
Coin flips and random selection for unbiased decision-making tools and applications.
๐งช Simulations
Monte Carlo simulations, random testing data, and probabilistic modeling scenarios.
โ ๏ธ Error Conditions
The API returns the same human-readable error string shown above โ no numeric error codes. Triggers are summarised in the table inside the Response Format โ Error Response section.
๐ฆ Rate Limits
This endpoint is rate-limited per client identity (IP address, or API key when one is supplied): 120 requests per minute. When the budget is exhausted the API responds with HTTP 429 and includes X-RateLimit-* headers so clients can self-throttle. The exact policy is configured in api/includes/api_config.php.
๐ฏ Ready to Try?
Test the Random Generator API with our interactive web interface or start integrating it into your application.
Try Web Interface Test API Endpoint