Generator Utilities

Flip Coin

Generates a random coin flip result returning either "heads" or "tails". Use via MCP in Claude or Cursor for quick randomization tasks, or call GET /v1/generate/coin directly. Perfect for adding true randomness to decision-making workflows, game mechanics, or A/B testing scenarios where you need unbiased binary outcomes.

API Endpoint

GET /v1/generate/coin

Code Examples

curl "https://tinyfn.io/v1/generate/coin" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/generate/coin', {
  headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
console.log(data);
import requests

response = requests.get('https://tinyfn.io/v1/generate/coin',
    headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)

Use via MCP

Add to your AI agent

Connect your AI agent (Claude, Cursor, Windsurf, etc.) to TinyFn's generator tools:

{
  "mcpServers": {
    "tinyfn-generator": {
      "url": "https://tinyfn.io/mcp/generator",
      "headers": {
        "X-API-Key": "YOUR_API_KEY"
      }
    }
  }
}

Learn more about MCP setup →

FAQ

What format does the coin flip API return?

Returns a JSON response with the result as either "heads" or "tails". The randomization is cryptographically secure for fair outcomes.

Can I flip multiple coins at once?

No, each API call returns a single coin flip result. For multiple flips, make separate requests or use the result in a loop within your MCP-enabled editor.

How do I use coin flip in Claude Code or Cursor?

Simply ask your AI assistant to "flip a coin" and it will use the MCP tool automatically. Great for breaking ties in code reviews or choosing between implementation approaches.

Is the coin flip truly random or deterministic?

The flip uses cryptographically secure randomization, not deterministic algorithms. Each call produces genuinely unpredictable results suitable for fair decision-making.

Can I weight the coin flip or set custom outcomes?

No, this tool only provides standard 50/50 coin flips with "heads" or "tails" results. For weighted randomization, use other probability tools.

Try Flip Coin Now

Get your free API key and start using Flip Coin in seconds.

Get Free API Key